From 67c5936f4249b8edcda8de9e70146d332730524a Mon Sep 17 00:00:00 2001 From: Kory Maincent Date: Tue, 4 Oct 2022 14:52:41 +0200 Subject: [PATCH] boot/at91bootstrap: disable PIE and stack-protector build flags The toolchain wrapper automatically adds Position Independent Execution and stack protector flags in the build process when selected in the configuration. at91bootstrap being freestanding code, it doesn't support these, so we have to disable them. Signed-off-by: Kory Maincent Signed-off-by: Thomas Petazzoni (cherry picked from commit 1351222486b93b72c00057fb3401d40967025164) Signed-off-by: Peter Korsgaard --- boot/at91bootstrap/at91bootstrap.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/boot/at91bootstrap/at91bootstrap.mk b/boot/at91bootstrap/at91bootstrap.mk index 1a084756fd..385957b5d4 100644 --- a/boot/at91bootstrap/at91bootstrap.mk +++ b/boot/at91bootstrap/at91bootstrap.mk @@ -32,8 +32,14 @@ endef AT91BOOTSTRAP_POST_PATCH_HOOKS += AT91BOOTSTRAP_APPLY_CUSTOM_PATCHES endif +# The at91bootstrap Makefile doesn't support customizing +# CFLAGS/LDFLAGS, so we cheat and pass our custom flags through CC and +# LD. define AT91BOOTSTRAP_BUILD_CMDS - $(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C $(@D)/$(AT91BOOTSTRAP_MAKE_SUBDIR) + $(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) \ + CC="$(TARGET_CC) -fno-stack-protector" \ + LD="$(TARGET_CC) -fno-PIE" \ + -C $(@D)/$(AT91BOOTSTRAP_MAKE_SUBDIR) endef define AT91BOOTSTRAP_INSTALL_IMAGES_CMDS