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