x86: Move CET infrastructure to x86_64
[glibc.git] / sysdeps / unix / sysv / linux / x86_64 / Makefile
blob4223feb95f6fe2f570f1770e5e8c2a749147a1ff
1 ifeq ($(subdir),misc)
2 sysdep_routines += ioperm iopl
3 endif
5 ifeq ($(subdir),stdlib)
6 sysdep_routines += __start_context allocate-shadow-stack
7 endif
9 ifeq ($(subdir),csu)
10 gen-as-const-headers += ucontext_i.sym
11 endif
13 ifeq ($(subdir),misc)
14 gen-as-const-headers += sigaltstack-offsets.sym
15 endif
17 ifeq ($(subdir),elf)
18 ifeq (yes,$(enable-x86-isa-level))
19 tests += \
20 tst-glibc-hwcaps-2
21 ifeq (no,$(build-hardcoded-path-in-tests))
22 # This is an ld.so.cache test, and RPATH/RUNPATH in the executable
23 # interferes with its test objectives.
24 tests-container += \
25 tst-glibc-hwcaps-2-cache
26 endif
27 modules-names += \
28 libx86-64-isa-level-1 \
29 libx86-64-isa-level-2 \
30 libx86-64-isa-level-3 \
31 libx86-64-isa-level-4
33 $(objpfx)tst-glibc-hwcaps-2: $(objpfx)libx86-64-isa-level.so
35 $(objpfx)tst-glibc-hwcaps-2.out: \
36 $(objpfx)glibc-hwcaps/x86-64-v2/libx86-64-isa-level.so \
37 $(objpfx)glibc-hwcaps/x86-64-v4/libx86-64-isa-level.so \
38 $(objpfx)glibc-hwcaps/x86-64-v3/libx86-64-isa-level.so
39 $(objpfx)glibc-hwcaps/x86-64-v2/libx86-64-isa-level.so: \
40 $(objpfx)libx86-64-isa-level-2.so
41 $(make-target-directory)
42 cp $< $@
43 $(objpfx)glibc-hwcaps/x86-64-v3/libx86-64-isa-level.so: \
44 $(objpfx)libx86-64-isa-level-3.so
45 $(make-target-directory)
46 cp $< $@
47 $(objpfx)glibc-hwcaps/x86-64-v4/libx86-64-isa-level.so: \
48 $(objpfx)libx86-64-isa-level-4.so
49 $(make-target-directory)
50 cp $< $@
52 CFLAGS-libx86-64-isa-level-1.os += -march=x86-64
53 CFLAGS-libx86-64-isa-level-2.os += -march=x86-64
54 CFLAGS-libx86-64-isa-level-3.os += -march=x86-64
55 CFLAGS-libx86-64-isa-level-4.os += -march=x86-64
57 # The test modules are parameterized by preprocessor macros.
58 LDFLAGS-libx86-64-isa-level-1.so += -Wl,-soname,libx86-64-isa-level.so
59 LDFLAGS-libx86-64-isa-level-4.so += -Wl,-soname,libx86-64-isa-level.so
60 $(objpfx)libx86-64-isa-level%.os: $(..)/sysdeps/unix/sysv/linux/x86_64/x86-64-isa-level-VALUE.c
61 $(compile-command.c) -DVALUE=$(lastword $(subst -, ,$*)) \
62 -DISA_LEVEL="(1 << ($(lastword $(subst -, ,$*)) - 1))"
63 $(objpfx)libx86-64-isa-level.so: $(objpfx)libx86-64-isa-level-1.so
64 cp $< $@
65 endif
66 endif # $(subdir) == elf
68 ifneq ($(enable-cet),no)
69 ifeq ($(subdir),elf)
70 tests += tst-cet-property-1 tst-cet-property-2
72 CFLAGS-tst-cet-property-1.o += -fcf-protection
73 ASFLAGS-tst-cet-property-dep-2.o += -fcf-protection
75 $(objpfx)tst-cet-property-2: $(objpfx)tst-cet-property-dep-2.o
76 $(objpfx)tst-cet-property-2.out: $(objpfx)tst-cet-property-2 \
77 $(objpfx)tst-cet-property-1.out
78 env $(run-program-env) $(test-via-rtld-prefix) \
79 $(objpfx)tst-cet-property-2 \
80 < $(objpfx)tst-cet-property-1.out > $@; \
81 $(evaluate-test)
82 endif
84 ifeq ($(subdir),posix)
85 tests += tst-cet-vfork-1
86 CFLAGS-tst-cet-vfork-1.c += -mshstk
87 endif
89 ifeq ($(subdir),stdlib)
90 tests += tst-cet-setcontext-1
91 CFLAGS-tst-cet-setcontext-1.c += -mshstk
92 endif
93 endif