linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han <jaxson.han@arm.com>
Subject: [boot-wrapper PATCH v2 3/9] Makefile: Tell compiler to generate bare-metal code
Date: Wed, 22 Dec 2021 18:16:01 +0000	[thread overview]
Message-ID: <20211222181607.1203191-4-andre.przywara@arm.com> (raw)
In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com>

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 and headers, since they might pull in more code than
we want, and might not run well in the boot-wrapper environment.

This also enables optimisation, since it produces much better code and
tends to avoid problems due to missing inlining, for instance.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 Makefile.am | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 3e970a3..d9ad6d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -124,9 +124,14 @@ CHOSEN_NODE	:= chosen {						\
 
 CPPFLAGS	+= $(INITRD_FLAGS)
 CFLAGS		+= -I$(top_srcdir)/include/ -I$(top_srcdir)/$(ARCH_SRC)/include/
-CFLAGS		+= -Wall -fomit-frame-pointer
+CFLAGS		+= -Wall -Wstrict-prototypes -fomit-frame-pointer
+CFLAGS		+= -ffreestanding -nostdinc -nostdlib
+CFLAGS		+= -fno-common -fno-strict-aliasing -fno-stack-protector
+CFLAGS		+= -fno-toplevel-reorder
+CFLAGS		+= -fno-unwind-tables -fno-asynchronous-unwind-tables
 CFLAGS		+= -ffunction-sections -fdata-sections
 CFLAGS		+= -fno-pic -fno-pie
+CFLAGS		+= -Os
 LDFLAGS		+= --gc-sections
 
 OBJ		:= $(addprefix $(ARCH_SRC),$(ARCH_OBJ)) $(addprefix $(COMMON_SRC),$(COMMON_OBJ))
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-12-22 18:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 18:15 [boot-wrapper PATCH v2 0/9] Various (build system) fixes Andre Przywara
2021-12-22 18:15 ` [boot-wrapper PATCH v2 1/9] Makefile: Avoid .got section creation Andre Przywara
2022-01-07 13:49   ` Mark Rutland
2021-12-22 18:16 ` [boot-wrapper PATCH v2 2/9] Add standard headers Andre Przywara
2022-01-07 13:49   ` Mark Rutland
2022-01-07 14:31     ` Andre Przywara
2022-01-11 11:34       ` Mark Rutland
2021-12-22 18:16 ` Andre Przywara [this message]
2022-01-07 13:53   ` [boot-wrapper PATCH v2 3/9] Makefile: Tell compiler to generate bare-metal code Mark Rutland
2022-01-07 14:38     ` Andre Przywara
2022-01-11 11:30       ` Mark Rutland
2022-01-18 12:52         ` Andre Przywara
2022-01-18 14:10           ` Ard Biesheuvel
2021-12-22 18:16 ` [boot-wrapper PATCH v2 4/9] configure: Make PSCI the default boot method Andre Przywara
2022-01-07 14:12   ` Mark Rutland
2021-12-22 18:16 ` [boot-wrapper PATCH v2 5/9] configure: Fix default DTB Andre Przywara
2022-01-07 14:13   ` Mark Rutland
2021-12-22 18:16 ` [boot-wrapper PATCH v2 6/9] configure: Use earlycon instead of earlyprintk Andre Przywara
2022-01-07 14:01   ` Mark Rutland
2022-01-07 14:14     ` Mark Rutland
2022-01-07 14:47     ` Andre Przywara
2021-12-22 18:16 ` [boot-wrapper PATCH v2 7/9] pointer auth: Document CPU feature bit mask Andre Przywara
2022-01-07 14:15   ` Mark Rutland
2021-12-22 18:16 ` [boot-wrapper PATCH v2 8/9] configure: Autodetect GICv3 Andre Przywara
2022-01-07 14:19   ` Mark Rutland
2021-12-22 18:16 ` [boot-wrapper PATCH v2 9/9] avoid dtc warnings on re-compiling DTB Andre Przywara
2022-01-07 13:59   ` Mark Rutland
2022-01-13 18:42   ` Vladimir Murzin
2022-01-13 19:50     ` Andre Przywara
2022-01-14  8:35       ` Vladimir Murzin
2022-01-14 10:44         ` Mark Rutland
2022-01-14 12:09           ` Andre Przywara
2022-01-19 12:02             ` Mark Rutland
2022-01-07 14:25 ` [boot-wrapper PATCH v2 0/9] Various (build system) fixes Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211222181607.1203191-4-andre.przywara@arm.com \
    --to=andre.przywara@arm.com \
    --cc=jaxson.han@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).