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