[PATCH v3] Makefile: Tell compiler to generate bare-metal code
Russell King (Oracle)
linux at armlinux.org.uk
Mon Jan 17 09:49:43 PST 2022
On Mon, Jan 17, 2022 at 03:33:48PM +0000, Andre Przywara wrote:
> 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 adds code that relies on userland:
> "If a guard check fails, an error message is printed and the program
> exits." (from the gcc manpage).
>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> ---
> Hi,
>
> compared to [PATCH v2 3/9] this drops the more contentious options (for
> now, at least), and focuses on what's really needed. Including
> -fno-stack-protector, as the need for this showed up in the cleanup series
> already.
There is history here. -ffreestanding has been tried before. See:
https://patchwork.kernel.org/project/linux-kbuild/patch/20200817220212.338670-5-ndesaulniers@google.com/
Have the issues in that thread been addressed?
If not, -ffreestanding does not belong in the top-level makefile.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
More information about the linux-arm-kernel
mailing list