]>
Commit | Line | Data |
---|---|---|
ec8f24b7 | 1 | # SPDX-License-Identifier: GPL-2.0-only |
e2c0cdfb PD |
2 | # Copied from arch/tile/kernel/vdso/Makefile |
3 | ||
4 | # Symbols present in the vdso | |
28dfbe6e | 5 | vdso-syms = rt_sigreturn |
d4c08b97 | 6 | ifdef CONFIG_64BIT |
28dfbe6e AW |
7 | vdso-syms += gettimeofday |
8 | vdso-syms += clock_gettime | |
9 | vdso-syms += clock_getres | |
d4c08b97 | 10 | endif |
28dfbe6e | 11 | vdso-syms += getcpu |
921ebd8f | 12 | vdso-syms += flush_icache |
e2c0cdfb PD |
13 | |
14 | # Files to link into the vdso | |
15 | obj-vdso = $(patsubst %, %.o, $(vdso-syms)) | |
16 | ||
17 | # Build rules | |
18 | targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o | |
19 | obj-vdso := $(addprefix $(obj)/, $(obj-vdso)) | |
20 | ||
21 | obj-y += vdso.o vdso-syms.o | |
22 | CPPFLAGS_vdso.lds += -P -C -U$(ARCH) | |
23 | ||
24 | # Disable gcov profiling for VDSO code | |
25 | GCOV_PROFILE := n | |
26 | ||
27 | # Force dependency | |
28 | $(obj)/vdso.o: $(obj)/vdso.so | |
29 | ||
30 | # link rule for the .so file, .lds has to be first | |
31 | SYSCFLAGS_vdso.so.dbg = $(c_flags) | |
32 | $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE | |
33 | $(call if_changed,vdsold) | |
34 | ||
35 | # We also create a special relocatable object that should mirror the symbol | |
36 | # table and layout of the linked DSO. With ld -R we can then refer to | |
37 | # these symbols in the kernel code rather than hand-coded addresses. | |
38 | ||
39 | SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ | |
fd7f744c | 40 | -Wl,--hash-style=both |
e2c0cdfb PD |
41 | $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE |
42 | $(call if_changed,vdsold) | |
43 | ||
44 | LDFLAGS_vdso-syms.o := -r -R | |
45 | $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE | |
46 | $(call if_changed,ld) | |
47 | ||
48 | # strip rule for the .so file | |
49 | $(obj)/%.so: OBJCOPYFLAGS := -S | |
50 | $(obj)/%.so: $(obj)/%.so.dbg FORCE | |
51 | $(call if_changed,objcopy) | |
52 | ||
53 | # actual build commands | |
54 | # The DSO images are built using a special linker script | |
55 | # Add -lgcc so rv32 gets static muldi3 and lshrdi3 definitions. | |
56 | # Make sure only to export the intended __vdso_xxx symbol offsets. | |
57 | quiet_cmd_vdsold = VDSOLD $@ | |
4938c79b PD |
58 | cmd_vdsold = $(CC) $(KBUILD_CFLAGS) $(call cc-option, -no-pie) -nostdlib -nostartfiles $(SYSCFLAGS_$(@F)) \ |
59 | -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp && \ | |
e2c0cdfb PD |
60 | $(CROSS_COMPILE)objcopy \ |
61 | $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ | |
62 | ||
63 | # install commands for the unstripped file | |
64 | quiet_cmd_vdso_install = INSTALL $@ | |
65 | cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@ | |
66 | ||
67 | vdso.so: $(obj)/vdso.so.dbg | |
68 | @mkdir -p $(MODLIB)/vdso | |
69 | $(call cmd,vdso_install) | |
70 | ||
71 | vdso_install: vdso.so |