]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - arch/tile/kernel/vdso/Makefile
Merge remote-tracking branches 'regulator/fix/axp20x', 'regulator/fix/cpcap' and...
[mirror_ubuntu-focal-kernel.git] / arch / tile / kernel / vdso / Makefile
1 # Symbols present in the vdso
2 vdso-syms = rt_sigreturn gettimeofday
3
4 # Files to link into the vdso
5 obj-vdso = $(patsubst %, v%.o, $(vdso-syms))
6
7 # Build rules
8 targets := $(obj-vdso) vdso.so vdso.so.dbg vdso.lds vdso-dummy.o
9 obj-vdso := $(addprefix $(obj)/, $(obj-vdso))
10
11 # vdso32 is only for tilegx -m32 compat task.
12 VDSO32-$(CONFIG_COMPAT) := y
13
14 obj-y += vdso.o vdso-syms.o
15 obj-$(VDSO32-y) += vdso32.o
16 CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
17
18 # vDSO code runs in userspace and -pg doesn't help with profiling anyway.
19 CFLAGS_REMOVE_vdso.o = -pg
20 CFLAGS_REMOVE_vdso32.o = -pg
21 CFLAGS_REMOVE_vrt_sigreturn.o = -pg
22 CFLAGS_REMOVE_vrt_sigreturn32.o = -pg
23 CFLAGS_REMOVE_vgettimeofday.o = -pg
24 CFLAGS_REMOVE_vgettimeofday32.o = -pg
25
26 ifdef CONFIG_FEEDBACK_COLLECT
27 # vDSO code runs in userspace, not collecting feedback data.
28 CFLAGS_REMOVE_vdso.o = -ffeedback-generate
29 CFLAGS_REMOVE_vdso32.o = -ffeedback-generate
30 CFLAGS_REMOVE_vrt_sigreturn.o = -ffeedback-generate
31 CFLAGS_REMOVE_vrt_sigreturn32.o = -ffeedback-generate
32 CFLAGS_REMOVE_vgettimeofday.o = -ffeedback-generate
33 CFLAGS_REMOVE_vgettimeofday32.o = -ffeedback-generate
34 endif
35
36 # Disable gcov profiling for VDSO code
37 GCOV_PROFILE := n
38
39 # Force dependency
40 $(obj)/vdso.o: $(obj)/vdso.so
41
42 # link rule for the .so file, .lds has to be first
43 SYSCFLAGS_vdso.so.dbg = $(c_flags)
44 $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE
45 $(call if_changed,vdsold)
46
47 # We also create a special relocatable object that should mirror the symbol
48 # table and layout of the linked DSO. With ld -R we can then refer to
49 # these symbols in the kernel code rather than hand-coded addresses.
50
51 SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \
52 $(call cc-ldoption, -Wl$(comma)--hash-style=both)
53 SYSCFLAGS_vdso_dummy.o = -r
54 $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/vrt_sigreturn.o FORCE
55 $(call if_changed,vdsold)
56
57 LDFLAGS_vdso-syms.o := -r -R
58 $(obj)/vdso-syms.o: $(obj)/vdso-dummy.o FORCE
59 $(call if_changed,ld)
60
61 # strip rule for the .so file
62 $(obj)/%.so: OBJCOPYFLAGS := -S
63 $(obj)/%.so: $(obj)/%.so.dbg FORCE
64 $(call if_changed,objcopy)
65
66 # actual build commands
67 # The DSO images are built using a special linker script
68 # Add -lgcc so tilepro gets static muldi3 and lshrdi3 definitions.
69 # Make sure only to export the intended __vdso_xxx symbol offsets.
70 quiet_cmd_vdsold = VDSOLD $@
71 cmd_vdsold = $(CC) $(KCFLAGS) -nostdlib $(SYSCFLAGS_$(@F)) \
72 -Wl,-T,$(filter-out FORCE,$^) -o $@.tmp -lgcc && \
73 $(CROSS_COMPILE)objcopy \
74 $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@
75
76 # install commands for the unstripped file
77 quiet_cmd_vdso_install = INSTALL $@
78 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/$@
79
80 vdso.so: $(obj)/vdso.so.dbg
81 @mkdir -p $(MODLIB)/vdso
82 $(call cmd,vdso_install)
83
84 vdso32.so: $(obj)/vdso32.so.dbg
85 $(call cmd,vdso_install)
86
87 vdso_install: vdso.so
88 vdso32_install: vdso32.so
89
90
91 KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
92 KBUILD_AFLAGS_32 += -m32 -s
93 KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
94 KBUILD_CFLAGS_32 += -m32 -fPIC -shared
95
96 obj-vdso32 = $(patsubst %, v%32.o, $(vdso-syms))
97
98 targets += $(obj-vdso32) vdso32.so vdso32.so.dbg
99 obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
100
101 $(obj-vdso32:%=%): KBUILD_AFLAGS = $(KBUILD_AFLAGS_32)
102 $(obj-vdso32:%=%): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
103
104 $(obj)/vgettimeofday32.o: $(obj)/vgettimeofday.c FORCE
105 $(call if_changed_rule,cc_o_c)
106
107 $(obj)/vrt_sigreturn32.o: $(obj)/vrt_sigreturn.S FORCE
108 $(call if_changed,as_o_S)
109
110 # Force dependency
111 $(obj)/vdso32.o: $(obj)/vdso32.so
112
113 SYSCFLAGS_vdso32.so.dbg = -m32 -shared -s -Wl,-soname=linux-vdso32.so.1 \
114 $(call cc-ldoption, -Wl$(comma)--hash-style=both)
115 $(obj)/vdso32.so.dbg: $(src)/vdso.lds $(obj-vdso32) FORCE
116 $(call if_changed,vdsold)