Commit 237d873a authored by Dave Martin's avatar Dave Martin
Browse files

arm64: bti: Ensure test are not built as PIE

Compilers that generate PIE code by default will break the tests,
since they must be fully statically linked, whereas PIE requires a
dynamic linker to relocate the images at runtime.

So, forcibly disable PIE when building.

For good measure, also pass -static when linking.  With no standard
libraries and no PIE, this should make no difference, but let's
play safe.
Signed-off-by: default avatarDave Martin <>
parent 026ad4c1
......@@ -4,6 +4,7 @@
CFLAGS = -O2 -g
CROSS_COMPILE = aarch64-linux-gnu-
......@@ -12,7 +13,8 @@ TESTS = btitest nobtitest
CFLAGS_BTI = -mbranch-protection=standard -DBTI=1
CFLAGS_COMMON = -ffreestanding -Wall -Wextra -MMD $(CFLAGS)
CFLAGS_COMMON = -fno-pie -no-pie -ffreestanding -Wall -Wextra -MMD $(CFLAGS)
LDFLAGS_COMMON = -static -nostdlib $(LDFLAGS)
......@@ -60,7 +62,7 @@ nobtitest: $(NOBTI_OBJS)
CFLAGS-nobtitest = $(CFLAGS_NOBTI)
$(CC) $(CPPFLAGS) $(CFLAGS-$@) $(CFLAGS_COMMON) -nostdlib -o $@ $^
clean: FORCE
$(RM) $(TESTS) *.[od]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment