diff mbox series

boot/at91bootstrap: disable PIE and stack-protector build flags

Message ID 20221004125242.136925-1-kory.maincent@bootlin.com
State New
Headers show
Series boot/at91bootstrap: disable PIE and stack-protector build flags | expand

Commit Message

Köry Maincent Oct. 4, 2022, 12:52 p.m. UTC
From: Kory Maincent <kory.maincent@bootlin.com>

The toolchain wrapper add automatically Position Independent Execution
and stack protector flags in the build process when selected in the
configuration. at91bootstrap does not support these, therefore I added a
patch to disable them in the Makefiles

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
 ...ck-protector-and-the-PIE-build-flags.patch | 502 ++++++++++++++++++
 1 file changed, 502 insertions(+)
 create mode 100644 boot/at91bootstrap/0004-ensure-the-stack-protector-and-the-PIE-build-flags.patch
diff mbox series

Patch

diff --git a/boot/at91bootstrap/0004-ensure-the-stack-protector-and-the-PIE-build-flags.patch b/boot/at91bootstrap/0004-ensure-the-stack-protector-and-the-PIE-build-flags.patch
new file mode 100644
index 0000000000..a4cc3819d0
--- /dev/null
+++ b/boot/at91bootstrap/0004-ensure-the-stack-protector-and-the-PIE-build-flags.patch
@@ -0,0 +1,502 @@ 
+From 66f7a5ed597adb166461531e8c914b07bbd41563 Mon Sep 17 00:00:00 2001
+From: Kory Maincent <kory.maincent@bootlin.com>
+Date: Tue, 4 Oct 2022 11:39:24 +0200
+Subject: [PATCH] ensure the stack protector and the PIE build flags are
+ disabled
+
+at91bootstrap does not support to build with stack-protector and position
+independant executable.
+Add -fno-stack-protector and -fno-PIE to the Makefiles to disable it.
+
+Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
+---
+ board/at91cap9adk/dataflash/Makefile      | 4 ++--
+ board/at91cap9adk/norflash/Makefile       | 4 ++--
+ board/at91cap9stk/nandflash/Makefile      | 4 ++--
+ board/at91sam9260ek/dataflash/Makefile    | 4 ++--
+ board/at91sam9260ek/nandflash/Makefile    | 4 ++--
+ board/at91sam9261ek/dataflash/Makefile    | 4 ++--
+ board/at91sam9261ek/nandflash/Makefile    | 4 ++--
+ board/at91sam9263ek/dataflash/Makefile    | 4 ++--
+ board/at91sam9263ek/nandflash/Makefile    | 4 ++--
+ board/at91sam9g10ek/dataflash/Makefile    | 4 ++--
+ board/at91sam9g10ek/nandflash/Makefile    | 4 ++--
+ board/at91sam9g20ek/dataflash/Makefile    | 4 ++--
+ board/at91sam9g20ek/nandflash/Makefile    | 4 ++--
+ board/at91sam9g45ekes/nandflash/Makefile  | 4 ++--
+ board/at91sam9m10ekes/dataflash/Makefile  | 4 ++--
+ board/at91sam9m10ekes/nandflash/Makefile  | 4 ++--
+ board/at91sam9m10g45ek/dataflash/Makefile | 4 ++--
+ board/at91sam9m10g45ek/nandflash/Makefile | 4 ++--
+ board/at91sam9rlek/dataflash/Makefile     | 4 ++--
+ board/at91sam9rlek/nandflash/Makefile     | 4 ++--
+ board/at91sam9xeek/dataflash/Makefile     | 4 ++--
+ board/at91sam9xeek/nandflash/Makefile     | 4 ++--
+ 22 files changed, 44 insertions(+), 44 deletions(-)
+
+diff --git a/board/at91cap9adk/dataflash/Makefile b/board/at91cap9adk/dataflash/Makefile
+index 5196783..e904788 100644
+--- a/board/at91cap9adk/dataflash/Makefile
++++ b/board/at91cap9adk/dataflash/Makefile
+@@ -34,14 +34,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91cap9adk/norflash/Makefile b/board/at91cap9adk/norflash/Makefile
+index 22390e8..8ac8301 100644
+--- a/board/at91cap9adk/norflash/Makefile
++++ b/board/at91cap9adk/norflash/Makefile
+@@ -34,14 +34,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91cap9stk/nandflash/Makefile b/board/at91cap9stk/nandflash/Makefile
+index 0b5b0ef..31ed32e 100755
+--- a/board/at91cap9stk/nandflash/Makefile
++++ b/board/at91cap9stk/nandflash/Makefile
+@@ -37,7 +37,7 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ 
+@@ -45,7 +45,7 @@ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9260ek/dataflash/Makefile b/board/at91sam9260ek/dataflash/Makefile
+index 8035a3b..8765e9c 100644
+--- a/board/at91sam9260ek/dataflash/Makefile
++++ b/board/at91sam9260ek/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9260ek/nandflash/Makefile b/board/at91sam9260ek/nandflash/Makefile
+index 7c3982d..a816ba3 100644
+--- a/board/at91sam9260ek/nandflash/Makefile
++++ b/board/at91sam9260ek/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9261ek/dataflash/Makefile b/board/at91sam9261ek/dataflash/Makefile
+index 2f7e637..c265c8b 100644
+--- a/board/at91sam9261ek/dataflash/Makefile
++++ b/board/at91sam9261ek/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9261ek/nandflash/Makefile b/board/at91sam9261ek/nandflash/Makefile
+index 66d5712..fc1da7e 100644
+--- a/board/at91sam9261ek/nandflash/Makefile
++++ b/board/at91sam9261ek/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9263ek/dataflash/Makefile b/board/at91sam9263ek/dataflash/Makefile
+index 696e872..4e60260 100644
+--- a/board/at91sam9263ek/dataflash/Makefile
++++ b/board/at91sam9263ek/dataflash/Makefile
+@@ -34,14 +34,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9263ek/nandflash/Makefile b/board/at91sam9263ek/nandflash/Makefile
+index 7b90eab..a916fcf 100644
+--- a/board/at91sam9263ek/nandflash/Makefile
++++ b/board/at91sam9263ek/nandflash/Makefile
+@@ -33,14 +33,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -O0 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -O0 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib  -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9g10ek/dataflash/Makefile b/board/at91sam9g10ek/dataflash/Makefile
+index 84060d7..d2c9b33 100644
+--- a/board/at91sam9g10ek/dataflash/Makefile
++++ b/board/at91sam9g10ek/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9g10ek/nandflash/Makefile b/board/at91sam9g10ek/nandflash/Makefile
+index e9c1398..2cbb641 100644
+--- a/board/at91sam9g10ek/nandflash/Makefile
++++ b/board/at91sam9g10ek/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9g20ek/dataflash/Makefile b/board/at91sam9g20ek/dataflash/Makefile
+index a11b080..dd15946 100644
+--- a/board/at91sam9g20ek/dataflash/Makefile
++++ b/board/at91sam9g20ek/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9g20ek/nandflash/Makefile b/board/at91sam9g20ek/nandflash/Makefile
+index 109a3c8..630430f 100644
+--- a/board/at91sam9g20ek/nandflash/Makefile
++++ b/board/at91sam9g20ek/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9g45ekes/nandflash/Makefile b/board/at91sam9g45ekes/nandflash/Makefile
+index a96a5fa..99c02d8 100644
+--- a/board/at91sam9g45ekes/nandflash/Makefile
++++ b/board/at91sam9g45ekes/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9m10ekes/dataflash/Makefile b/board/at91sam9m10ekes/dataflash/Makefile
+index 28e8d42..17e2590 100644
+--- a/board/at91sam9m10ekes/dataflash/Makefile
++++ b/board/at91sam9m10ekes/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9m10ekes/nandflash/Makefile b/board/at91sam9m10ekes/nandflash/Makefile
+index 0ffd08d..01108de 100644
+--- a/board/at91sam9m10ekes/nandflash/Makefile
++++ b/board/at91sam9m10ekes/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9m10g45ek/dataflash/Makefile b/board/at91sam9m10g45ek/dataflash/Makefile
+index 0eefc52..805073a 100644
+--- a/board/at91sam9m10g45ek/dataflash/Makefile
++++ b/board/at91sam9m10g45ek/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9m10g45ek/nandflash/Makefile b/board/at91sam9m10g45ek/nandflash/Makefile
+index f7cde1b..121594d 100644
+--- a/board/at91sam9m10g45ek/nandflash/Makefile
++++ b/board/at91sam9m10g45ek/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9rlek/dataflash/Makefile b/board/at91sam9rlek/dataflash/Makefile
+index 83f5c62..0bd9261 100644
+--- a/board/at91sam9rlek/dataflash/Makefile
++++ b/board/at91sam9rlek/dataflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9rlek/nandflash/Makefile b/board/at91sam9rlek/nandflash/Makefile
+index 961a3fb..0e51a70 100644
+--- a/board/at91sam9rlek/nandflash/Makefile
++++ b/board/at91sam9rlek/nandflash/Makefile
+@@ -37,14 +37,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ OBJS=crt0_gnu.o
+ 
+diff --git a/board/at91sam9xeek/dataflash/Makefile b/board/at91sam9xeek/dataflash/Makefile
+index 07e0d4c..274fc30 100644
+--- a/board/at91sam9xeek/dataflash/Makefile
++++ b/board/at91sam9xeek/dataflash/Makefile
+@@ -38,14 +38,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ ifdef MEMORY_BASE
+ LDFLAGS+=-Tdata $(MEMORY_BASE)
+diff --git a/board/at91sam9xeek/nandflash/Makefile b/board/at91sam9xeek/nandflash/Makefile
+index ff7d7df..3b29a2b 100644
+--- a/board/at91sam9xeek/nandflash/Makefile
++++ b/board/at91sam9xeek/nandflash/Makefile
+@@ -38,14 +38,14 @@ NM= $(CROSS_COMPILE)nm
+ SIZE=$(CROSS_COMPILE)size
+ OBJCOPY=$(CROSS_COMPILE)objcopy
+ OBJDUMP=$(CROSS_COMPILE)objdump
+-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
++CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector
+ ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
+ 
+ # Linker flags.
+ #  -Wl,...:     tell GCC to pass this to linker.
+ #    -Map:      create map file
+ #    --cref:    add cross reference to map file
+-LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref
++LDFLAGS+=-nostartfiles -nostdlib -Wl,-Map=$(BOOT_NAME).map,--cref -fno-PIE
+ LDFLAGS+=-T $(BOOTSTRAP_PATH)/elf32-littlearm.lds -Ttext $(LINK_ADDR)
+ ifdef MEMORY_BASE
+ LDFLAGS+=-Tdata $(MEMORY_BASE)
+-- 
+2.25.1
+