]>
Commit | Line | Data |
---|---|---|
9031fefd WD |
1 | # |
2 | # Building a vDSO image for AArch64. | |
3 | # | |
4 | # Author: Will Deacon <will.deacon@arm.com> | |
5 | # Heavily based on the vDSO Makefiles for other archs. | |
6 | # | |
7 | ||
8 | obj-vdso := gettimeofday.o note.o sigreturn.o | |
9 | ||
10 | # Build rules | |
11 | targets := $(obj-vdso) vdso.so vdso.so.dbg | |
12 | obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) | |
13 | ||
14 | ccflags-y := -shared -fno-common -fno-builtin | |
15 | ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \ | |
16 | $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) | |
17 | ||
6f1a6ae8 WD |
18 | # Workaround for bare-metal (ELF) toolchains that neglect to pass -shared |
19 | # down to collect2, resulting in silent corruption of the vDSO image. | |
20 | ccflags-y += -Wl,-shared | |
21 | ||
9031fefd WD |
22 | obj-y += vdso.o |
23 | extra-y += vdso.lds vdso-offsets.h | |
24 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) | |
25 | ||
26 | # Force dependency (incbin is bad) | |
27 | $(obj)/vdso.o : $(obj)/vdso.so | |
28 | ||
29 | # Link rule for the .so file, .lds has to be first | |
30 | $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) | |
31 | $(call if_changed,vdsold) | |
32 | ||
33 | # Strip rule for the .so file | |
34 | $(obj)/%.so: OBJCOPYFLAGS := -S | |
35 | $(obj)/%.so: $(obj)/%.so.dbg FORCE | |
36 | $(call if_changed,objcopy) | |
37 | ||
38 | # Generate VDSO offsets using helper script | |
39 | gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh | |
40 | quiet_cmd_vdsosym = VDSOSYM $@ | |
41 | define cmd_vdsosym | |
42 | $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \ | |
43 | cp $@ include/generated/ | |
44 | endef | |
45 | ||
46 | $(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE | |
47 | $(call if_changed,vdsosym) | |
48 | ||
49 | # Assembly rules for the .S files | |
1915e2ad | 50 | $(obj-vdso): %.o: %.S FORCE |
9031fefd WD |
51 | $(call if_changed_dep,vdsoas) |
52 | ||
53 | # Actual build commands | |
ad789ba5 | 54 | quiet_cmd_vdsold = VDSOL $@ |
40507403 | 55 | cmd_vdsold = $(CC) $(c_flags) -Wl,-n -Wl,-T $^ -o $@ |
ad789ba5 | 56 | quiet_cmd_vdsoas = VDSOA $@ |
9031fefd WD |
57 | cmd_vdsoas = $(CC) $(a_flags) -c -o $@ $< |
58 | ||
59 | # Install commands for the unstripped file | |
60 | quiet_cmd_vdso_install = INSTALL $@ | |
61 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ | |
62 | ||
63 | vdso.so: $(obj)/vdso.so.dbg | |
64 | @mkdir -p $(MODLIB)/vdso | |
65 | $(call cmd,vdso_install) | |
66 | ||
67 | vdso_install: vdso.so |