diff options
author | Andre Przywara <andre.przywara@arm.com> | 2022-01-17 15:33:48 +0000 |
---|---|---|
committer | Mark Rutland <mark.rutland@arm.com> | 2022-01-17 17:11:53 +0000 |
commit | 16bca1c4147f6906f76d8961a09bf1682399d70f (patch) | |
tree | ca8886e1d7391816c308353108b921ccbf02df86 | |
parent | 1044c77062573985f7c994c3b6cef5695f57e955 (diff) | |
download | boot-wrapper-aarch64-16bca1c4147f6906f76d8961a09bf1682399d70f.tar.gz |
Makefile: Tell compiler to generate bare-metal code
Our GCC invocation does not provide many parameters, which lets the
toolchain fill in its own default setup.
In case of a native build or when using a full-featured cross-compiler,
this probably means Linux userland, which is not what we want for a
bare-metal application like boot-wrapper.
Tell the compiler to forget about those standard settings, and only use
what we explicitly ask for. In particular that means to not use toolchain
provided libraries, since they might pull in more code than we want, and
might not run well in the boot-wrapper environment.
Disable the stack protector, as this relies on support code, e.g.
a __stack_chk_guard variable and __stack_chk_fail function, which the
boot-wrapper does not implement.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r-- | Makefile.am | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index f941b07..c621707 100644 --- a/Makefile.am +++ b/Makefile.am @@ -125,6 +125,8 @@ CHOSEN_NODE := chosen { \ CPPFLAGS += $(INITRD_FLAGS) CFLAGS += -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/ CFLAGS += -Wall -fomit-frame-pointer +CFLAGS += -ffreestanding -nostdlib +CFLAGS += -fno-stack-protector CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -fno-pic -fno-pie LDFLAGS += --gc-sections |