1ifeq ($(subdir),csu) 2gen-as-const-headers += cpu-features-offsets.sym 3endif 4 5ifeq ($(subdir),elf) 6sysdep_routines += get-cpuid-feature-leaf 7sysdep-dl-routines += dl-get-cpu-features 8sysdep_headers += sys/platform/x86.h bits/platform/x86.h 9 10CFLAGS-dl-get-cpu-features.os += $(rtld-early-cflags) 11CFLAGS-get-cpuid-feature-leaf.o += $(no-stack-protector) 12 13tests += tst-get-cpu-features tst-get-cpu-features-static \ 14 tst-cpu-features-cpuinfo tst-cpu-features-cpuinfo-static \ 15 tst-cpu-features-supports tst-cpu-features-supports-static 16tests-static += tst-get-cpu-features-static \ 17 tst-cpu-features-cpuinfo-static \ 18 tst-cpu-features-supports-static 19ifeq (yes,$(have-ifunc)) 20ifeq (yes,$(have-gcc-ifunc)) 21tests += \ 22 tst-ifunc-isa-1 \ 23 tst-ifunc-isa-1-static 24tests-static += \ 25 tst-ifunc-isa-1-static 26test-xfail-tst-ifunc-isa-1 = $(with-lld) 27test-xfail-tst-ifunc-isa-1-static = $(with-lld) 28ifneq ($(have-tunables),no) 29tests += \ 30 tst-ifunc-isa-2 \ 31 tst-ifunc-isa-2-static 32tests-static += \ 33 tst-ifunc-isa-2-static 34test-xfail-tst-ifunc-isa-2 = $(with-lld) 35test-xfail-tst-ifunc-isa-2-static = $(with-lld) 36endif 37endif 38endif 39ifeq (yes,$(enable-x86-isa-level)) 40tests += tst-isa-level-1 41modules-names += tst-isa-level-mod-1-baseline \ 42 tst-isa-level-mod-1-v2 \ 43 tst-isa-level-mod-1-v3 \ 44 tst-isa-level-mod-1-v4 \ 45 46# X86 ISA level baseline 47CFLAGS-tst-isa-level-mod-1-baseline.c += -DINCLUDE_X86_ISA_LEVEL \ 48 -DISA_LEVEL=0x1 \ 49 -march=x86-64 50# X86 ISA level v2 51CFLAGS-tst-isa-level-mod-1-v2.c += -DINCLUDE_X86_ISA_LEVEL \ 52 -DISA_LEVEL=0x3 \ 53 -march=x86-64 54# X86 ISA level v3 55CFLAGS-tst-isa-level-mod-1-v3.c += -DINCLUDE_X86_ISA_LEVEL \ 56 -DISA_LEVEL=0x7 \ 57 -march=x86-64 58# X86 ISA level v4 59CFLAGS-tst-isa-level-mod-1-v4.c += -DINCLUDE_X86_ISA_LEVEL \ 60 -DISA_LEVEL=0xf \ 61 -march=x86-64 62 63$(objpfx)tst-isa-level-1.out: $(objpfx)tst-isa-level-mod-1-baseline.so \ 64 $(objpfx)tst-isa-level-mod-1-v2.so \ 65 $(objpfx)tst-isa-level-mod-1-v3.so \ 66 $(objpfx)tst-isa-level-mod-1-v4.so 67endif 68ifneq ($(have-tunables),no) 69tst-ifunc-isa-2-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SSE4_2,-AVX,-AVX2,-AVX512F 70tst-ifunc-isa-2-static-ENV = $(tst-ifunc-isa-2-ENV) 71endif 72endif 73 74ifeq ($(subdir),math) 75tests += tst-ldbl-nonnormal-printf 76endif # $(subdir) == math 77 78ifeq ($(subdir),setjmp) 79gen-as-const-headers += jmp_buf-ssp.sym 80sysdep_routines += __longjmp_cancel 81ifneq ($(enable-cet),no) 82ifneq ($(have-tunables),no) 83tests += tst-setjmp-cet 84tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on 85endif 86endif 87endif 88 89ifeq ($(subdir),string) 90sysdep_routines += cacheinfo 91 92tests += \ 93 tst-memchr-rtm \ 94 tst-memcmp-rtm \ 95 tst-memmove-rtm \ 96 tst-memrchr-rtm \ 97 tst-memset-rtm \ 98 tst-strcasecmp-rtm \ 99 tst-strchr-rtm \ 100 tst-strcmp-rtm \ 101 tst-strcpy-rtm \ 102 tst-strlen-rtm \ 103 tst-strncasecmp-rtm \ 104 tst-strncmp-rtm \ 105 tst-strrchr-rtm \ 106 tst-wcscmp-rtm \ 107 tst-wcsncmp-rtm \ 108# tests 109 110CFLAGS-tst-memchr-rtm.c += -mrtm 111CFLAGS-tst-memcmp-rtm.c += -mrtm 112CFLAGS-tst-memmove-rtm.c += -mrtm 113CFLAGS-tst-memrchr-rtm.c += -mrtm 114CFLAGS-tst-memset-rtm.c += -mrtm 115CFLAGS-tst-strcasecmp-rtm.c += -mrtm 116CFLAGS-tst-strchr-rtm.c += -mrtm 117CFLAGS-tst-strcmp-rtm.c += -mrtm 118CFLAGS-tst-strcpy-rtm.c += -mrtm 119CFLAGS-tst-strlen-rtm.c += -mrtm 120CFLAGS-tst-strncasecmp-rtm.c += -mrtm -Wno-error 121CFLAGS-tst-strncmp-rtm.c += -mrtm -Wno-error 122CFLAGS-tst-strrchr-rtm.c += -mrtm 123CFLAGS-tst-wcscmp-rtm.c += -mrtm 124CFLAGS-tst-wcsncmp-rtm.c += -mrtm -Wno-error 125endif 126 127ifneq ($(enable-cet),no) 128ifeq ($(subdir),elf) 129sysdep-dl-routines += dl-cet 130 131tests += tst-cet-legacy-1 tst-cet-legacy-1a tst-cet-legacy-2 \ 132 tst-cet-legacy-2a tst-cet-legacy-3 tst-cet-legacy-4 \ 133 tst-cet-legacy-5a tst-cet-legacy-6a tst-cet-legacy-7 \ 134 tst-cet-legacy-8 tst-cet-legacy-9 tst-cet-legacy-9-static \ 135 tst-cet-legacy-10 tst-cet-legacy-10-static 136tests-static += tst-cet-legacy-9-static tst-cet-legacy-10-static 137tst-cet-legacy-1a-ARGS = -- $(host-test-program-cmd) 138ifneq (no,$(have-tunables)) 139tests += tst-cet-legacy-4a tst-cet-legacy-4b tst-cet-legacy-4c \ 140 tst-cet-legacy-5b tst-cet-legacy-6b 141endif 142modules-names += tst-cet-legacy-mod-1 tst-cet-legacy-mod-2 \ 143 tst-cet-legacy-mod-4 tst-cet-legacy-mod-5a \ 144 tst-cet-legacy-mod-5b tst-cet-legacy-mod-5c \ 145 tst-cet-legacy-mod-6a tst-cet-legacy-mod-6b \ 146 tst-cet-legacy-mod-6c 147 148CFLAGS-tst-cet-legacy-2.c += -fcf-protection=branch 149CFLAGS-tst-cet-legacy-2a.c += -fcf-protection 150CFLAGS-tst-cet-legacy-mod-1.c += -fcf-protection=none 151CFLAGS-tst-cet-legacy-mod-2.c += -fcf-protection=none 152CFLAGS-tst-cet-legacy-3.c += -fcf-protection=none 153CFLAGS-tst-cet-legacy-4.c += -fcf-protection=branch 154CFLAGS-tst-cet-legacy-4a.c += -fcf-protection 155CFLAGS-tst-cet-legacy-4b.c += -fcf-protection 156CFLAGS-tst-cet-legacy-mod-4.c += -fcf-protection=none 157CFLAGS-tst-cet-legacy-5a.c += -fcf-protection -mshstk 158ifeq ($(enable-cet),permissive) 159CPPFLAGS-tst-cet-legacy-5a.c += -DCET_IS_PERMISSIVE=1 160endif 161CFLAGS-tst-cet-legacy-5b.c += -fcf-protection -mshstk 162CPPFLAGS-tst-cet-legacy-5b.c += -DCET_DISABLED_BY_ENV=1 163CFLAGS-tst-cet-legacy-mod-5a.c += -fcf-protection=branch 164CFLAGS-tst-cet-legacy-mod-5b.c += -fcf-protection 165CFLAGS-tst-cet-legacy-mod-5c.c += -fcf-protection 166CFLAGS-tst-cet-legacy-6a.c += -fcf-protection -mshstk 167ifeq ($(enable-cet),permissive) 168CPPFLAGS-tst-cet-legacy-6a.c += -DCET_IS_PERMISSIVE=1 169endif 170CFLAGS-tst-cet-legacy-6b.c += -fcf-protection -mshstk 171CPPFLAGS-tst-cet-legacy-6b.c += -DCET_DISABLED_BY_ENV=1 172CFLAGS-tst-cet-legacy-mod-6a.c += -fcf-protection=branch 173CFLAGS-tst-cet-legacy-mod-6b.c += -fcf-protection 174CFLAGS-tst-cet-legacy-mod-6c.c += -fcf-protection 175CFLAGS-tst-cet-legacy-7.c += -fcf-protection=none 176CFLAGS-tst-cet-legacy-8.c += -mshstk 177CFLAGS-tst-cet-legacy-10.c += -mshstk 178CFLAGS-tst-cet-legacy-10-static.c += -mshstk 179 180$(objpfx)tst-cet-legacy-1: $(objpfx)tst-cet-legacy-mod-1.so \ 181 $(objpfx)tst-cet-legacy-mod-2.so 182$(objpfx)tst-cet-legacy-1a: $(objpfx)tst-cet-legacy-mod-1.so \ 183 $(objpfx)tst-cet-legacy-mod-2.so 184$(objpfx)tst-cet-legacy-2: $(objpfx)tst-cet-legacy-mod-2.so 185$(objpfx)tst-cet-legacy-2.out: $(objpfx)tst-cet-legacy-mod-1.so 186$(objpfx)tst-cet-legacy-2a: $(objpfx)tst-cet-legacy-mod-2.so 187$(objpfx)tst-cet-legacy-2a.out: $(objpfx)tst-cet-legacy-mod-1.so 188$(objpfx)tst-cet-legacy-4.out: $(objpfx)tst-cet-legacy-mod-4.so 189$(objpfx)tst-cet-legacy-5a.out: $(objpfx)tst-cet-legacy-mod-5a.so \ 190 $(objpfx)tst-cet-legacy-mod-5b.so 191$(objpfx)tst-cet-legacy-mod-5a.so: $(objpfx)tst-cet-legacy-mod-5c.so 192$(objpfx)tst-cet-legacy-mod-5b.so: $(objpfx)tst-cet-legacy-mod-5c.so 193$(objpfx)tst-cet-legacy-6a.out: $(objpfx)tst-cet-legacy-mod-6a.so \ 194 $(objpfx)tst-cet-legacy-mod-6b.so 195$(objpfx)tst-cet-legacy-mod-6a.so: $(objpfx)tst-cet-legacy-mod-6c.so 196$(objpfx)tst-cet-legacy-mod-6b.so: $(objpfx)tst-cet-legacy-mod-6c.so 197LDFLAGS-tst-cet-legacy-mod-6c.so = -Wl,--enable-new-dtags,-z,nodelete 198ifneq (no,$(have-tunables)) 199$(objpfx)tst-cet-legacy-4a.out: $(objpfx)tst-cet-legacy-mod-4.so 200tst-cet-legacy-4a-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=permissive 201$(objpfx)tst-cet-legacy-4b.out: $(objpfx)tst-cet-legacy-mod-4.so 202tst-cet-legacy-4b-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=on 203$(objpfx)tst-cet-legacy-4c.out: $(objpfx)tst-cet-legacy-mod-4.so 204tst-cet-legacy-4c-ENV = GLIBC_TUNABLES=glibc.cpu.x86_shstk=off 205$(objpfx)tst-cet-legacy-5b.out: $(objpfx)tst-cet-legacy-mod-5a.so \ 206 $(objpfx)tst-cet-legacy-mod-5b.so 207tst-cet-legacy-5b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK 208$(objpfx)tst-cet-legacy-6b.out: $(objpfx)tst-cet-legacy-mod-6a.so \ 209 $(objpfx)tst-cet-legacy-mod-6b.so 210tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK 211tst-cet-legacy-9-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK 212tst-cet-legacy-9-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK 213endif 214endif 215 216# Add -fcf-protection to CFLAGS when CET is enabled. 217CFLAGS-.o += -fcf-protection 218CFLAGS-.os += -fcf-protection 219CFLAGS-.op += -fcf-protection 220CFLAGS-.oS += -fcf-protection 221 222# Compile assembly codes with <cet.h> when CET is enabled. 223asm-CPPFLAGS += -fcf-protection -include cet.h 224 225ifeq ($(subdir),elf) 226ifeq (yes,$(build-shared)) 227tests-special += $(objpfx)check-cet.out 228endif 229 230# FIXME: Can't use all-built-dso in elf/Makefile since this file is 231# processed before elf/Makefile. Duplicate it here. 232cet-built-dso := $(common-objpfx)elf/ld.so $(common-objpfx)libc.so \ 233 $(filter-out $(common-objpfx)linkobj/libc.so, \ 234 $(sort $(wildcard $(addprefix $(common-objpfx), \ 235 */lib*.so \ 236 iconvdata/*.so)))) 237 238$(cet-built-dso:=.note): %.note: % 239 @rm -f $@T 240 LC_ALL=C $(READELF) -n $< > $@T 241 test -s $@T 242 mv -f $@T $@ 243common-generated += $(cet-built-dso:$(common-objpfx)%=%.note) 244 245$(objpfx)check-cet.out: $(..)sysdeps/x86/check-cet.awk \ 246 $(cet-built-dso:=.note) 247 LC_ALL=C $(AWK) -f $^ > $@; \ 248 $(evaluate-test) 249generated += check-cet.out 250endif 251endif 252 253ifeq ($(subdir),posix) 254tests += \ 255 tst-sysconf-cache-linesize \ 256 tst-sysconf-cache-linesize-static 257tests-static += \ 258 tst-sysconf-cache-linesize-static 259endif 260