aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86_64/Makefile')
-rw-r--r--sysdeps/x86_64/Makefile50
1 files changed, 32 insertions, 18 deletions
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index 5723ec1..8cace35 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -11,6 +11,7 @@ endif
ifeq ($(subdir),csu)
gen-as-const-headers += link-defines.sym
+gen-as-const-headers += tlsdesc.sym rtld-offsets.sym
endif
ifeq ($(subdir),gmon)
@@ -19,6 +20,10 @@ sysdep_routines += _mcount
# recursive calls when ENTRY is used. Just copy the normal static
# object.
sysdep_noprof += _mcount
+
+ifeq (yes,$(have-x86-apx))
+CFLAGS-mcount.c += -mno-apxf
+endif
endif
ifeq ($(subdir),string)
@@ -41,9 +46,6 @@ ifeq ($(subdir),elf)
CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
-mno-mmx)
-sysdep-dl-routines += tlsdesc dl-tlsdesc tls_get_addr
-
-tests += ifuncmain8
modules-names += ifuncmod8
$(objpfx)ifuncmain8: $(objpfx)ifuncmod8.so
@@ -214,11 +216,25 @@ $(objpfx)tst-plt-rewrite2: $(objpfx)tst-plt-rewritemod2.so
endif
test-internal-extras += tst-gnu2-tls2mod1
-endif # $(subdir) == elf
-ifeq ($(subdir),csu)
-gen-as-const-headers += tlsdesc.sym rtld-offsets.sym
-endif
+tests-special += $(objpfx)check-rtld.out
+
+$(objpfx)rtld.reloc: $(objpfx)rtld.os
+ @rm -f $@T
+ LC_ALL=C $(READELF) -rW $< > $@T
+ test -s $@T
+ mv -f $@T $@
+common-generated += $(objpfx)rtld.reloc
+
+# Verify that there are no run-time relocations against __ehdr_start nor
+# _end.
+$(objpfx)check-rtld.out: $(objpfx)rtld.reloc
+ LC_ALL=C; \
+ if grep -E "R_X86_64_64.*(__ehdr_start|_end)" $^ > $@; \
+ then false; else true; fi; \
+ $(evaluate-test)
+generated += check-rtld.out
+endif # $(subdir) == elf
ifeq ($(subdir),wcsmbs)
@@ -250,6 +266,15 @@ endif
ifneq ($(enable-cet),no)
+# Add -fcf-protection to CFLAGS when CET is enabled.
+CFLAGS-.o += -fcf-protection
+CFLAGS-.os += -fcf-protection
+CFLAGS-.op += -fcf-protection
+CFLAGS-.oS += -fcf-protection
+
+# Compile assembly codes with <cet.h> when CET is enabled.
+asm-CPPFLAGS += -fcf-protection -include cet.h
+
ifeq ($(subdir),elf)
sysdep-dl-routines += dl-cet
@@ -442,18 +467,7 @@ $(objpfx)tst-shstk-legacy-1g.out: \
$(..)/sysdeps/x86_64/tst-shstk-legacy-1g.sh $(objpfx)tst-shstk-legacy-1g
$(SHELL) $< $(common-objpfx) '$(test-program-prefix)' 2> $@; \
$(evaluate-test)
-endif
-# Add -fcf-protection to CFLAGS when CET is enabled.
-CFLAGS-.o += -fcf-protection
-CFLAGS-.os += -fcf-protection
-CFLAGS-.op += -fcf-protection
-CFLAGS-.oS += -fcf-protection
-
-# Compile assembly codes with <cet.h> when CET is enabled.
-asm-CPPFLAGS += -fcf-protection -include cet.h
-
-ifeq ($(subdir),elf)
ifeq (yes,$(build-shared))
tests-special += $(objpfx)check-cet.out
endif