aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/aarch64/Makefile
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2020-06-30 11:12:40 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2020-07-08 15:02:38 +0100
commitde9301c02e898fb20a609b459d81afda42f39c61 (patch)
treeaec3591ba34744a0dd84798f74313bb871859f7f /sysdeps/aarch64/Makefile
parent605338745ba15930e9acac46c32ce6cada12a52b (diff)
downloadglibc-de9301c02e898fb20a609b459d81afda42f39c61.tar
glibc-de9301c02e898fb20a609b459d81afda42f39c61.tar.gz
glibc-de9301c02e898fb20a609b459d81afda42f39c61.tar.bz2
glibc-de9301c02e898fb20a609b459d81afda42f39c61.zip
aarch64: ensure objects are BTI compatible
When glibc is built with branch protection (i.e. with a gcc configured with --enable-standard-branch-protection), all glibc binaries should be BTI compatible and marked as such. It is easy to link BTI incompatible objects by accident and this is silent currently which is usually not the expectation, so this is changed into a link error. (There is no linker flag for failing on BTI incompatible inputs so all warnings are turned into fatal errors outside the test system when building glibc with branch protection.) Unfortunately, outlined atomic functions are not BTI compatible in libgcc (PR libgcc/96001), so to build glibc with current gcc use 'CC=gcc -mno-outline-atomics', this should be fixed in libgcc soon and then glibc can be built and tested without such workarounds. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/aarch64/Makefile')
-rw-r--r--sysdeps/aarch64/Makefile8
1 files changed, 8 insertions, 0 deletions
diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile
index 5ae8b082b0..7f82fc055e 100644
--- a/sysdeps/aarch64/Makefile
+++ b/sysdeps/aarch64/Makefile
@@ -1,5 +1,13 @@
long-double-fcts = yes
+ifeq (yes,$(aarch64-bti))
+# Mark linker output BTI compatible, it warns on non-BTI inputs.
+sysdep-LDFLAGS += -Wl,-z,force-bti
+# Make warnings fatal outside the test system.
+LDFLAGS-lib.so += -Wl,--fatal-warnings
+LDFLAGS-rtld += -Wl,-z,force-bti,--fatal-warnings
+endif
+
ifeq ($(subdir),elf)
sysdep-dl-routines += dl-bti
endif