]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/x86_64/Makefile
x86_64: Suppress false positive valgrind error
[thirdparty/glibc.git] / sysdeps / x86_64 / Makefile
1 # The i387 `long double' is a distinct type we support.
2 long-double-fcts = yes
3
4 ifeq (yes,$(have-z-mark-plt))
5 # Always generate DT_X86_64_PLT* tags.
6 sysdep-LDFLAGS += -Wl,-z,mark-plt
7 # Never generate DT_X86_64_PLT* tags on ld.so to avoid changing its own
8 # PLT.
9 LDFLAGS-rtld += -Wl,-z,nomark-plt
10 endif
11
12 ifeq ($(subdir),csu)
13 gen-as-const-headers += link-defines.sym
14 endif
15
16 ifeq ($(subdir),gmon)
17 sysdep_routines += _mcount
18 # We cannot compile _mcount.S with -pg because that would create
19 # recursive calls when ENTRY is used. Just copy the normal static
20 # object.
21 sysdep_noprof += _mcount
22 endif
23
24 ifeq ($(subdir),string)
25 sysdep_routines += \
26 strcasecmp_l-nonascii \
27 strcspn-generic \
28 strncase_l-nonascii \
29 strpbrk-generic \
30 strspn-generic \
31 varshift \
32 # sysdep_routines
33 gen-as-const-headers += locale-defines.sym
34 tests += \
35 tst-rsi-strlen \
36 # tests
37 endif
38
39 ifeq ($(subdir),elf)
40 # There is no good reason to use MMX in x86-64 ld.so with GCC.
41 CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
42 -mno-mmx)
43
44 sysdep-dl-routines += tlsdesc dl-tlsdesc tls_get_addr
45
46 tests += ifuncmain8
47 modules-names += ifuncmod8
48
49 $(objpfx)ifuncmain8: $(objpfx)ifuncmod8.so
50
51 tests += tst-quad1 tst-quad2
52 modules-names += tst-quadmod1 tst-quadmod2
53
54 $(objpfx)tst-quad1: $(objpfx)tst-quadmod1.so
55 $(objpfx)tst-quad2: $(objpfx)tst-quadmod2.so
56
57 quad-pie-test += tst-quad1pie tst-quad2pie
58 tests += $(quad-pie-test)
59 tests-pie += $(quad-pie-test)
60 test-extras += tst-quadmod1pie tst-quadmod2pie
61 extra-test-objs += tst-quadmod1pie.o tst-quadmod2pie.o
62
63 $(objpfx)tst-quad1pie: $(objpfx)tst-quadmod1pie.o
64 $(objpfx)tst-quad2pie: $(objpfx)tst-quadmod2pie.o
65
66 CFLAGS-tst-quad1pie.c = $(PIE-ccflag)
67 CFLAGS-tst-quad2pie.c = $(PIE-ccflag)
68
69 tests += tst-platform-1
70 modules-names += tst-platformmod-1 x86_64/tst-platformmod-2
71 extra-test-objs += tst-platformmod-2.o
72 CFLAGS-tst-platform-1.c = -mno-avx
73 CFLAGS-tst-platformmod-1.c = -mno-avx
74 CFLAGS-tst-platformmod-2.c = -mno-avx
75 LDFLAGS-tst-platformmod-2.so = -Wl,-soname,tst-platformmod-2.so
76 $(objpfx)tst-platform-1: $(objpfx)tst-platformmod-1.so
77 $(objpfx)tst-platform-1.out: $(objpfx)x86_64/tst-platformmod-2.so
78 # Turn off AVX512F and AVX2 so that GLRO(dl_platform) is
79 # always set to x86_64.
80 tst-platform-1-ENV = LD_PRELOAD=$(objpfx)\$$PLATFORM/tst-platformmod-2.so \
81 GLIBC_TUNABLES=glibc.cpu.hwcaps=-AVX512F,-AVX2
82
83 tests += tst-audit3 tst-audit4 tst-audit5 tst-audit6 tst-audit7 \
84 tst-audit10 tst-sse tst-avx tst-avx512
85 test-extras += tst-audit4-aux tst-audit10-aux \
86 tst-avx-aux tst-avx512-aux
87 extra-test-objs += tst-audit4-aux.o tst-audit10-aux.o \
88 tst-avx-aux.o tst-avx512-aux.o
89
90 ifeq ($(have-insert),yes)
91 tests += tst-split-dynreloc
92 LDFLAGS-tst-split-dynreloc = -Wl,-T,$(..)sysdeps/x86_64/tst-split-dynreloc.lds
93 tst-split-dynreloc-ENV = LD_BIND_NOW=1
94 endif
95
96 modules-names += tst-auditmod3a tst-auditmod3b \
97 tst-auditmod4a tst-auditmod4b \
98 tst-auditmod5a tst-auditmod5b \
99 tst-auditmod6a tst-auditmod6b tst-auditmod6c \
100 tst-auditmod7a tst-auditmod7b \
101 tst-auditmod10a tst-auditmod10b \
102 tst-ssemod tst-avxmod tst-avx512mod
103
104 $(objpfx)tst-audit3: $(objpfx)tst-auditmod3a.so
105 $(objpfx)tst-audit3.out: $(objpfx)tst-auditmod3b.so
106 tst-audit3-ENV = LD_AUDIT=$(objpfx)tst-auditmod3b.so
107
108 $(objpfx)tst-audit4: $(objpfx)tst-audit4-aux.o $(objpfx)tst-auditmod4a.so
109 $(objpfx)tst-audit4.out: $(objpfx)tst-auditmod4b.so
110 tst-audit4-ENV = LD_AUDIT=$(objpfx)tst-auditmod4b.so
111
112 $(objpfx)tst-audit5: $(objpfx)tst-auditmod5a.so
113 $(objpfx)tst-audit5.out: $(objpfx)tst-auditmod5b.so
114 tst-audit5-ENV = LD_AUDIT=$(objpfx)tst-auditmod5b.so
115
116 $(objpfx)tst-audit6: $(objpfx)tst-auditmod6a.so
117 $(objpfx)tst-audit6.out: $(objpfx)tst-auditmod6b.so \
118 $(objpfx)tst-auditmod6c.so
119 tst-audit6-ENV = LD_AUDIT=$(objpfx)tst-auditmod6b.so:$(objpfx)tst-auditmod6c.so
120
121 $(objpfx)tst-audit7: $(objpfx)tst-auditmod7a.so
122 $(objpfx)tst-audit7.out: $(objpfx)tst-auditmod7b.so
123 tst-audit7-ENV = LD_AUDIT=$(objpfx)tst-auditmod7b.so
124
125 $(objpfx)tst-audit10: $(objpfx)tst-audit10-aux.o $(objpfx)tst-auditmod10a.so
126 $(objpfx)tst-audit10.out: $(objpfx)tst-auditmod10b.so
127 tst-audit10-ENV = LD_AUDIT=$(objpfx)tst-auditmod10b.so
128
129 $(objpfx)tst-sse: $(objpfx)tst-ssemod.so
130 $(objpfx)tst-avx: $(objpfx)tst-avx-aux.o $(objpfx)tst-avxmod.so
131 $(objpfx)tst-avx512: $(objpfx)tst-avx512-aux.o $(objpfx)tst-avx512mod.so
132
133 AVX-CFLAGS=-mavx -mno-vzeroupper
134 CFLAGS-tst-audit4-aux.c += $(AVX-CFLAGS)
135 CFLAGS-tst-auditmod4a.c += $(AVX-CFLAGS)
136 CFLAGS-tst-auditmod4b.c += $(AVX-CFLAGS)
137 CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
138 CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
139 CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
140 CFLAGS-tst-avx-aux.c += $(AVX-CFLAGS)
141 CFLAGS-tst-avxmod.c += $(AVX-CFLAGS)
142 AVX512-CFLAGS = -mavx512f
143 CFLAGS-tst-audit10-aux.c += $(AVX512-CFLAGS)
144 CFLAGS-tst-auditmod10a.c += $(AVX512-CFLAGS)
145 CFLAGS-tst-auditmod10b.c += $(AVX512-CFLAGS)
146 CFLAGS-tst-avx512-aux.c += $(AVX512-CFLAGS)
147 CFLAGS-tst-avx512mod.c += $(AVX512-CFLAGS)
148
149 $(objpfx)tst-glibc-hwcaps: $(objpfx)libmarkermod2-1.so \
150 $(objpfx)libmarkermod3-1.so $(objpfx)libmarkermod4-1.so
151 $(objpfx)tst-glibc-hwcaps.out: \
152 $(objpfx)libmarkermod2.so \
153 $(objpfx)glibc-hwcaps/x86-64-v2/libmarkermod2.so \
154 $(objpfx)libmarkermod3.so \
155 $(objpfx)glibc-hwcaps/x86-64-v2/libmarkermod3.so \
156 $(objpfx)glibc-hwcaps/x86-64-v3/libmarkermod3.so \
157 $(objpfx)libmarkermod4.so \
158 $(objpfx)glibc-hwcaps/x86-64-v2/libmarkermod4.so \
159 $(objpfx)glibc-hwcaps/x86-64-v3/libmarkermod4.so \
160 $(objpfx)glibc-hwcaps/x86-64-v4/libmarkermod4.so \
161
162 $(objpfx)glibc-hwcaps/x86-64-v2/libmarkermod2.so: $(objpfx)libmarkermod2-2.so
163 $(make-target-directory)
164 cp $< $@
165 $(objpfx)glibc-hwcaps/x86-64-v2/libmarkermod3.so: $(objpfx)libmarkermod3-2.so
166 $(make-target-directory)
167 cp $< $@
168 $(objpfx)glibc-hwcaps/x86-64-v3/libmarkermod3.so: $(objpfx)libmarkermod3-3.so
169 $(make-target-directory)
170 cp $< $@
171 $(objpfx)glibc-hwcaps/x86-64-v2/libmarkermod4.so: $(objpfx)libmarkermod4-2.so
172 $(make-target-directory)
173 cp $< $@
174 $(objpfx)glibc-hwcaps/x86-64-v3/libmarkermod4.so: $(objpfx)libmarkermod4-3.so
175 $(make-target-directory)
176 cp $< $@
177 $(objpfx)glibc-hwcaps/x86-64-v4/libmarkermod4.so: $(objpfx)libmarkermod4-4.so
178 $(make-target-directory)
179 cp $< $@
180
181 ifeq (no,$(build-hardcoded-path-in-tests))
182 # This is an ld.so.cache test, and RPATH/RUNPATH in the executable
183 # interferes with its test objectives.
184 tests-container += tst-glibc-hwcaps-cache
185 endif
186
187 ifeq (yes,$(have-z-mark-plt))
188 tests += \
189 tst-plt-rewrite1 \
190 tst-plt-rewrite2 \
191 # tests
192 modules-names += \
193 tst-plt-rewritemod1 \
194 tst-plt-rewritemod2 \
195 # modules-names
196
197 tst-plt-rewrite1-no-pie = yes
198 LDFLAGS-tst-plt-rewrite1 = -Wl,-z,now
199 LDFLAGS-tst-plt-rewritemod1.so = -Wl,-z,now
200 tst-plt-rewrite1-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=1 LD_DEBUG=files:bindings
201 $(objpfx)tst-plt-rewrite1: $(objpfx)tst-plt-rewritemod1.so
202 $(objpfx)tst-plt-rewrite1.out: /dev/null $(objpfx)tst-plt-rewrite1
203 $(tst-plt-rewrite1-ENV) $(make-test-out) > $@ 2>&1; \
204 grep -q -E "changing 'bar' PLT entry in .*/elf/tst-plt-rewritemod1.so' to direct branch" $@; \
205 $(evaluate-test)
206
207 tst-plt-rewrite2-no-pie = yes
208 LDFLAGS-tst-plt-rewrite2 = -Wl,-z,now
209 LDFLAGS-tst-plt-rewritemod2.so = -Wl,-z,now,-z,undefs
210 tst-plt-rewrite2-ENV = GLIBC_TUNABLES=glibc.cpu.plt_rewrite=2
211 $(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
212 endif
213
214 # Check if ISA level is 3 or above.
215 ifneq (,$(filter $(have-x86-isa-level),$(x86-isa-level-3-or-above)))
216 valgrind-suppressions-tst-valgrind-smoke = \
217 --suppressions=$(..)sysdeps/x86_64/tst-valgrind-smoke.supp
218 endif
219
220 endif # $(subdir) == elf
221
222 ifeq ($(subdir),csu)
223 gen-as-const-headers += tlsdesc.sym rtld-offsets.sym
224 endif
225
226 ifeq ($(subdir),wcsmbs)
227
228 sysdep_routines += \
229 wcpcpy-generic \
230 wcpncpy-generic \
231 wcscat-generic \
232 wcscpy-generic \
233 wcsncat-generic \
234 wcsncmp-generic \
235 wcsncpy-generic \
236 wcsnlen-generic \
237 # sysdep_routines
238
239 tests += \
240 tst-rsi-wcslen \
241 # tests
242 endif
243
244
245 ifeq ($(subdir),setjmp)
246 ifneq ($(enable-cet),no)
247 tests += \
248 tst-setjmp-cet \
249 # tests
250 tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on
251 endif
252 endif
253
254
255 ifneq ($(enable-cet),no)
256 ifeq ($(subdir),elf)
257 sysdep-dl-routines += dl-cet
258
259 tests += \
260 tst-cet-legacy-1 \
261 tst-cet-legacy-10 \
262 tst-cet-legacy-10-static \
263 tst-cet-legacy-10a \
264 tst-cet-legacy-10a-static \
265 tst-cet-legacy-1a \
266 tst-cet-legacy-2 \
267 tst-cet-legacy-2a \
268 tst-cet-legacy-3 \
269 tst-cet-legacy-4 \
270 tst-cet-legacy-5a \
271 tst-cet-legacy-6a \
272 tst-cet-legacy-7 \
273 tst-cet-legacy-8 \
274 tst-cet-legacy-9 \
275 tst-cet-legacy-9-static \
276 # tests
277 tests-static += \
278 tst-cet-legacy-10-static \
279 tst-cet-legacy-10a-static \
280 tst-cet-legacy-9-static \
281 # tests-static
282 tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd)
283
284 tests += \
285 tst-shstk-legacy-1a \
286 tst-shstk-legacy-1a-static \
287 tst-shstk-legacy-1b \
288 tst-shstk-legacy-1b-static \
289 tst-shstk-legacy-1c \
290 tst-shstk-legacy-1c-static \
291 tst-shstk-legacy-1d \
292 tst-shstk-legacy-1d-static \
293 tst-shstk-legacy-1e \
294 tst-shstk-legacy-1e-static \
295 tst-shstk-legacy-1f \
296 tst-shstk-legacy-1g \
297 # tests
298 modules-names += \
299 tst-shstk-legacy-mod-1 \
300 # modules-names
301 tests-static += \
302 tst-shstk-legacy-1a-static \
303 tst-shstk-legacy-1b-static \
304 tst-shstk-legacy-1c-static \
305 tst-shstk-legacy-1d-static \
306 tst-shstk-legacy-1e-static \
307 # tests-static
308 extra-objs += \
309 tst-shstk-legacy-1-extra.o \
310 # extra-objs
311
312 tests += \
313 tst-cet-legacy-4a \
314 tst-cet-legacy-4b \
315 tst-cet-legacy-4c \
316 tst-cet-legacy-5b \
317 tst-cet-legacy-6b \
318 # tests
319 modules-names += \
320 tst-cet-legacy-mod-1 \
321 tst-cet-legacy-mod-2 \
322 tst-cet-legacy-mod-4 \
323 tst-cet-legacy-mod-5a \
324 tst-cet-legacy-mod-5b \
325 tst-cet-legacy-mod-5c \
326 tst-cet-legacy-mod-6a \
327 tst-cet-legacy-mod-6b \
328 tst-cet-legacy-mod-6c \
329 # modules-names
330
331 CFLAGS-tst-cet-legacy-2.c += -fcf-protection=none -fcf-protection=branch
332 CFLAGS-tst-cet-legacy-2a.c += -fcf-protection
333 CFLAGS-tst-cet-legacy-mod-1.c += -fcf-protection=none
334 CFLAGS-tst-cet-legacy-mod-2.c += -fcf-protection=none
335 CFLAGS-tst-cet-legacy-3.c += -fcf-protection=none
336 CFLAGS-tst-cet-legacy-4.c += -fcf-protection=none -fcf-protection=branch
337 CPPFLAGS-tst-cet-legacy-4a.c += -DCET_IS_PERMISSIVE=1
338 CFLAGS-tst-cet-legacy-4a.c += -fcf-protection
339 CFLAGS-tst-cet-legacy-4b.c += -fcf-protection
340 CFLAGS-tst-cet-legacy-mod-4.c += -fcf-protection=none
341 CFLAGS-tst-cet-legacy-5a.c += -fcf-protection -mshstk
342 ifeq ($(enable-cet),permissive)
343 CPPFLAGS-tst-cet-legacy-5a.c += -DCET_IS_PERMISSIVE=1
344 endif
345 CFLAGS-tst-cet-legacy-5b.c += -fcf-protection -mshstk
346 CPPFLAGS-tst-cet-legacy-5b.c += -DCET_DISABLED_BY_ENV=1
347 CFLAGS-tst-cet-legacy-mod-5a.c += -fcf-protection=none -fcf-protection=branch
348 CFLAGS-tst-cet-legacy-mod-5b.c += -fcf-protection
349 CFLAGS-tst-cet-legacy-mod-5c.c += -fcf-protection
350 CFLAGS-tst-cet-legacy-6a.c += -fcf-protection -mshstk
351 ifeq ($(enable-cet),permissive)
352 CPPFLAGS-tst-cet-legacy-6a.c += -DCET_IS_PERMISSIVE=1
353 endif
354 CFLAGS-tst-cet-legacy-6b.c += -fcf-protection -mshstk
355 CPPFLAGS-tst-cet-legacy-6b.c += -DCET_DISABLED_BY_ENV=1
356 CFLAGS-tst-cet-legacy-mod-6a.c += -fcf-protection=none -fcf-protection=branch
357 CFLAGS-tst-cet-legacy-mod-6b.c += -fcf-protection
358 CFLAGS-tst-cet-legacy-mod-6c.c += -fcf-protection
359 CFLAGS-tst-cet-legacy-7.c += -fcf-protection=none
360 CFLAGS-tst-cet-legacy-10.c += -mshstk
361 CFLAGS-tst-cet-legacy-10-static.c += -mshstk
362 CFLAGS-tst-cet-legacy-10a.c += -fcf-protection=none
363 CFLAGS-tst-cet-legacy-10a-static.c += -fcf-protection=none
364
365 tst-cet-legacy-4-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
366 tst-cet-legacy-6-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
367 tst-cet-legacy-10-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
368 tst-cet-legacy-10-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
369 tst-cet-legacy-10a-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
370 tst-cet-legacy-10a-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
371
372 CFLAGS-tst-shstk-legacy-1a.c += -fcf-protection=none
373 CFLAGS-tst-shstk-legacy-1a-static.c += -fcf-protection=none
374 CFLAGS-tst-shstk-legacy-1d.c += -fcf-protection=none
375 CFLAGS-tst-shstk-legacy-1d-static.c += -fcf-protection=none
376 CFLAGS-tst-shstk-legacy-1f.c += -fcf-protection=none
377
378 $(objpfx)tst-cet-legacy-1: $(objpfx)tst-cet-legacy-mod-1.so \
379 $(objpfx)tst-cet-legacy-mod-2.so
380 $(objpfx)tst-cet-legacy-1a: $(objpfx)tst-cet-legacy-mod-1.so \
381 $(objpfx)tst-cet-legacy-mod-2.so
382 $(objpfx)tst-cet-legacy-2: $(objpfx)tst-cet-legacy-mod-2.so
383 $(objpfx)tst-cet-legacy-2.out: $(objpfx)tst-cet-legacy-mod-1.so
384 $(objpfx)tst-cet-legacy-2a: $(objpfx)tst-cet-legacy-mod-2.so
385 $(objpfx)tst-cet-legacy-2a.out: $(objpfx)tst-cet-legacy-mod-1.so
386 $(objpfx)tst-cet-legacy-4.out: $(objpfx)tst-cet-legacy-mod-4.so
387 $(objpfx)tst-cet-legacy-5a.out: $(objpfx)tst-cet-legacy-mod-5a.so \
388 $(objpfx)tst-cet-legacy-mod-5b.so
389 $(objpfx)tst-cet-legacy-mod-5a.so: $(objpfx)tst-cet-legacy-mod-5c.so
390 $(objpfx)tst-cet-legacy-mod-5b.so: $(objpfx)tst-cet-legacy-mod-5c.so
391 $(objpfx)tst-cet-legacy-6a.out: $(objpfx)tst-cet-legacy-mod-6a.so \
392 $(objpfx)tst-cet-legacy-mod-6b.so
393 $(objpfx)tst-cet-legacy-mod-6a.so: $(objpfx)tst-cet-legacy-mod-6c.so
394 $(objpfx)tst-cet-legacy-mod-6b.so: $(objpfx)tst-cet-legacy-mod-6c.so
395 LDFLAGS-tst-cet-legacy-mod-6c.so = -Wl,--enable-new-dtags,-z,nodelete
396 $(objpfx)tst-cet-legacy-4a.out: $(objpfx)tst-cet-legacy-mod-4.so
397 tst-cet-legacy-4a-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=permissive
398 $(objpfx)tst-cet-legacy-4b.out: $(objpfx)tst-cet-legacy-mod-4.so
399 tst-cet-legacy-4b-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=on
400 $(objpfx)tst-cet-legacy-4c.out: $(objpfx)tst-cet-legacy-mod-4.so
401 tst-cet-legacy-4c-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=off
402 $(objpfx)tst-cet-legacy-5b.out: $(objpfx)tst-cet-legacy-mod-5a.so \
403 $(objpfx)tst-cet-legacy-mod-5b.so
404 tst-cet-legacy-5b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
405 $(objpfx)tst-cet-legacy-6b.out: $(objpfx)tst-cet-legacy-mod-6a.so \
406 $(objpfx)tst-cet-legacy-mod-6b.so
407 tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
408 tst-cet-legacy-9-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
409 tst-cet-legacy-9-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK
410
411 tst-shstk-legacy-1a-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
412 tst-shstk-legacy-1a-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
413 $(objpfx)tst-shstk-legacy-1a: $(objpfx)tst-shstk-legacy-1-extra.o
414 $(objpfx)tst-shstk-legacy-1a-static: $(objpfx)tst-shstk-legacy-1-extra.o
415 tst-shstk-legacy-1b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
416 tst-shstk-legacy-1b-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
417 $(objpfx)tst-shstk-legacy-1b: $(objpfx)tst-shstk-legacy-1-extra.o
418 $(objpfx)tst-shstk-legacy-1b-static: $(objpfx)tst-shstk-legacy-1-extra.o
419 tst-shstk-legacy-1c-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SHSTK
420 tst-shstk-legacy-1c-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SHSTK
421 $(objpfx)tst-shstk-legacy-1c: $(objpfx)tst-shstk-legacy-1-extra.o
422 $(objpfx)tst-shstk-legacy-1c-static: $(objpfx)tst-shstk-legacy-1-extra.o
423 tst-shstk-legacy-1d-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
424 tst-shstk-legacy-1d-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
425 $(objpfx)tst-shstk-legacy-1d: $(objpfx)tst-shstk-legacy-1-extra.o
426 $(objpfx)tst-shstk-legacy-1d-static: $(objpfx)tst-shstk-legacy-1-extra.o
427 $(objpfx)tst-shstk-legacy-1e: $(objpfx)tst-shstk-legacy-1-extra.o
428 $(objpfx)tst-shstk-legacy-1e-static: $(objpfx)tst-shstk-legacy-1-extra.o
429 $(objpfx)tst-shstk-legacy-1e.out: \
430 $(..)/sysdeps/x86_64/tst-shstk-legacy-1e.sh $(objpfx)tst-shstk-legacy-1e
431 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' 2> $@; \
432 $(evaluate-test)
433 $(objpfx)tst-shstk-legacy-1e-static.out: \
434 $(..)/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh \
435 $(objpfx)tst-shstk-legacy-1e-static
436 $(SHELL) $< $(common-objpfx) 2> $@; \
437 $(evaluate-test)
438 tst-shstk-legacy-1f-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
439 $(objpfx)tst-shstk-legacy-1f: $(objpfx)tst-shstk-legacy-mod-1.so
440 $(objpfx)tst-shstk-legacy-mod-1.so: \
441 $(objpfx)tst-shstk-legacy-mod-1.os \
442 $(objpfx)tst-shstk-legacy-1-extra.os
443 $(objpfx)tst-shstk-legacy-1g: $(objpfx)tst-shstk-legacy-mod-1.so
444 $(objpfx)tst-shstk-legacy-1g.out: \
445 $(..)/sysdeps/x86_64/tst-shstk-legacy-1g.sh $(objpfx)tst-shstk-legacy-1g
446 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' 2> $@; \
447 $(evaluate-test)
448 endif
449
450 # Add -fcf-protection to CFLAGS when CET is enabled.
451 CFLAGS-.o += -fcf-protection
452 CFLAGS-.os += -fcf-protection
453 CFLAGS-.op += -fcf-protection
454 CFLAGS-.oS += -fcf-protection
455
456 # Compile assembly codes with <cet.h> when CET is enabled.
457 asm-CPPFLAGS += -fcf-protection -include cet.h
458
459 ifeq ($(subdir),elf)
460 ifeq (yes,$(build-shared))
461 tests-special += $(objpfx)check-cet.out
462 endif
463
464 # FIXME: Can't use all-built-dso in elf/Makefile since this file is
465 # processed before elf/Makefile. Duplicate it here.
466 cet-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \
467 $(filter-out $(common-objpfx)linkobj/libc.so, \
468 $(sort $(wildcard $(addprefix $(common-objpfx), \
469 */lib*.so \
470 iconvdata/*.so))))
471
472 $(cet-built-dso:=.note): %.note: %
473 @rm -f $@T
474 LC_ALL=C $(READELF) -n $< > $@T
475 test -s $@T
476 mv -f $@T $@
477 common-generated += $(cet-built-dso:$(common-objpfx)%=%.note)
478
479 $(objpfx)check-cet.out: $(..)sysdeps/x86_64/check-cet.awk \
480 $(cet-built-dso:=.note)
481 LC_ALL=C $(AWK) -f $^ > $@; \
482 $(evaluate-test)
483 generated += check-cet.out
484 endif # $(subdir) == elf
485 endif # $(enable) != no
486
487 do-tests-clean common-mostlyclean: tst-x86_64-1-clean
488
489 .PHONY: tst-x86_64-1-clean
490 tst-x86_64-1-clean:
491 -rm -rf $(objpfx)x86_64
492
493 $(objpfx)x86_64/tst-platformmod-2.os: $(objpfx)tst-platformmod-2.os
494 $(make-target-directory)
495 rm -f $@
496 ln $< $@