]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/mips/vdso/Makefile
Merge tag 'wireless-drivers-next-for-davem-2017-06-25' of git://git.kernel.org/pub...
[karo-tx-linux.git] / arch / mips / vdso / Makefile
1 # Objects to go into the VDSO.
2 obj-vdso-y := elf.o gettimeofday.o sigreturn.o
3
4 # Common compiler flags between ABIs.
5 ccflags-vdso := \
6         $(filter -I%,$(KBUILD_CFLAGS)) \
7         $(filter -E%,$(KBUILD_CFLAGS)) \
8         $(filter -mmicromips,$(KBUILD_CFLAGS)) \
9         $(filter -march=%,$(KBUILD_CFLAGS))
10 cflags-vdso := $(ccflags-vdso) \
11         $(filter -W%,$(filter-out -Wa$(comma)%,$(KBUILD_CFLAGS))) \
12         -O2 -g -fPIC -fno-strict-aliasing -fno-common -fno-builtin -G 0 \
13         -DDISABLE_BRANCH_PROFILING \
14         $(call cc-option, -fno-asynchronous-unwind-tables) \
15         $(call cc-option, -fno-stack-protector)
16 aflags-vdso := $(ccflags-vdso) \
17         -D__ASSEMBLY__ -Wa,-gdwarf-2
18
19 #
20 # For the pre-R6 code in arch/mips/vdso/vdso.h for locating
21 # the base address of VDSO, the linker will emit a R_MIPS_PC32
22 # relocation in binutils > 2.25 but it will fail with older versions
23 # because that relocation is not supported for that symbol. As a result
24 # of which we are forced to disable the VDSO symbols when building
25 # with < 2.25 binutils on pre-R6 kernels. For more references on why we
26 # can't use other methods to get the base address of VDSO please refer to
27 # the comments on that file.
28 #
29 ifndef CONFIG_CPU_MIPSR6
30   ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
31     $(warning MIPS VDSO requires binutils >= 2.25)
32     obj-vdso-y := $(filter-out gettimeofday.o, $(obj-vdso-y))
33     ccflags-vdso += -DDISABLE_MIPS_VDSO
34   endif
35 endif
36
37 # VDSO linker flags.
38 VDSO_LDFLAGS := \
39         -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 \
40         -nostdlib -shared \
41         $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) \
42         $(call cc-ldoption, -Wl$(comma)--build-id)
43
44 GCOV_PROFILE := n
45
46 #
47 # Shared build commands.
48 #
49
50 quiet_cmd_vdsold = VDSO    $@
51       cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \
52                    -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
53
54 quiet_cmd_vdsoas_o_S = AS       $@
55       cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
56
57 # Strip rule for the raw .so files
58 $(obj)/%.so.raw: OBJCOPYFLAGS := -S
59 $(obj)/%.so.raw: $(obj)/%.so.dbg.raw FORCE
60         $(call if_changed,objcopy)
61
62 hostprogs-y := genvdso
63
64 quiet_cmd_genvdso = GENVDSO $@
65 define cmd_genvdso
66         $(foreach file,$(filter %.raw,$^),cp $(file) $(file:%.raw=%) &&) \
67         $(obj)/genvdso $(<:%.raw=%) $(<:%.dbg.raw=%) $@ $(VDSO_NAME)
68 endef
69
70 #
71 # Build native VDSO.
72 #
73
74 native-abi := $(filter -mabi=%,$(KBUILD_CFLAGS))
75
76 targets += $(obj-vdso-y)
77 targets += vdso.lds
78 targets += vdso.so.dbg.raw vdso.so.raw
79 targets += vdso.so.dbg vdso.so
80 targets += vdso-image.c
81
82 obj-vdso := $(obj-vdso-y:%.o=$(obj)/%.o)
83
84 $(obj-vdso): KBUILD_CFLAGS := $(cflags-vdso) $(native-abi)
85 $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
86
87 $(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
88
89 $(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
90         $(call if_changed,vdsold)
91
92 $(obj)/vdso-image.c: $(obj)/vdso.so.dbg.raw $(obj)/vdso.so.raw \
93                      $(obj)/genvdso FORCE
94         $(call if_changed,genvdso)
95
96 obj-y += vdso-image.o
97
98 #
99 # Build O32 VDSO.
100 #
101
102 # Define these outside the ifdef to ensure they are picked up by clean.
103 targets += $(obj-vdso-y:%.o=%-o32.o)
104 targets += vdso-o32.lds
105 targets += vdso-o32.so.dbg.raw vdso-o32.so.raw
106 targets += vdso-o32.so.dbg vdso-o32.so
107 targets += vdso-o32-image.c
108
109 ifdef CONFIG_MIPS32_O32
110
111 obj-vdso-o32 := $(obj-vdso-y:%.o=$(obj)/%-o32.o)
112
113 $(obj-vdso-o32): KBUILD_CFLAGS := $(cflags-vdso) -mabi=32
114 $(obj-vdso-o32): KBUILD_AFLAGS := $(aflags-vdso) -mabi=32
115
116 $(obj)/%-o32.o: $(src)/%.S FORCE
117         $(call if_changed_dep,vdsoas_o_S)
118
119 $(obj)/%-o32.o: $(src)/%.c FORCE
120         $(call cmd,force_checksrc)
121         $(call if_changed_rule,cc_o_c)
122
123 $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32
124 $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE
125         $(call if_changed_dep,cpp_lds_S)
126
127 $(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE
128         $(call if_changed,vdsold)
129
130 $(obj)/vdso-o32-image.c: VDSO_NAME := o32
131 $(obj)/vdso-o32-image.c: $(obj)/vdso-o32.so.dbg.raw $(obj)/vdso-o32.so.raw \
132                          $(obj)/genvdso FORCE
133         $(call if_changed,genvdso)
134
135 obj-y += vdso-o32-image.o
136
137 endif
138
139 #
140 # Build N32 VDSO.
141 #
142
143 targets += $(obj-vdso-y:%.o=%-n32.o)
144 targets += vdso-n32.lds
145 targets += vdso-n32.so.dbg.raw vdso-n32.so.raw
146 targets += vdso-n32.so.dbg vdso-n32.so
147 targets += vdso-n32-image.c
148
149 ifdef CONFIG_MIPS32_N32
150
151 obj-vdso-n32 := $(obj-vdso-y:%.o=$(obj)/%-n32.o)
152
153 $(obj-vdso-n32): KBUILD_CFLAGS := $(cflags-vdso) -mabi=n32
154 $(obj-vdso-n32): KBUILD_AFLAGS := $(aflags-vdso) -mabi=n32
155
156 $(obj)/%-n32.o: $(src)/%.S FORCE
157         $(call if_changed_dep,vdsoas_o_S)
158
159 $(obj)/%-n32.o: $(src)/%.c FORCE
160         $(call cmd,force_checksrc)
161         $(call if_changed_rule,cc_o_c)
162
163 $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32
164 $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE
165         $(call if_changed_dep,cpp_lds_S)
166
167 $(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE
168         $(call if_changed,vdsold)
169
170 $(obj)/vdso-n32-image.c: VDSO_NAME := n32
171 $(obj)/vdso-n32-image.c: $(obj)/vdso-n32.so.dbg.raw $(obj)/vdso-n32.so.raw \
172                          $(obj)/genvdso FORCE
173         $(call if_changed,genvdso)
174
175 obj-y += vdso-n32-image.o
176
177 endif
178
179 # FIXME: Need install rule for debug.
180 # Needs to deal with dependency for generation of dbg by cmd_genvdso...