From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F5A7C433F5 for ; Wed, 22 Dec 2021 18:18:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0R2y0VxfnW7rs962o823jX/5CjxTeixhIbfUf7TL1+c=; b=IfEGKzZfvW+nzH 4IBBgSCPyqxZn75IAOJr0ZtYcY7/u+yEUK4eNq0uqNP+30HsnbuEzIP7B7Q9VWjdG4m1ShxCNRVim jgIFmMwnhlfTnRzeq0xDJu8vqVMk8GCC/KD7ilNTPxl74R+KSGLcvqeM2bLrgdXXIua+VusxBP9n8 q5DcgLxG0AoxI8gfHEyx3SmfJXHxg3RnhGPLoVI5CGNhsPtUSGgm5fmmqdeOGMTXZK7QQ2RwMFNU7 3mZoBfipr903ndSRxG98uMX58Xk8KcJwj6T5wt8x9Mb6HQXobHagWW2U+QZgQ8pXClPowv+B+Hu6Q Be+/iVzbIx5PBlBQhTgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n06Aj-00B3nq-Fk; Wed, 22 Dec 2021 18:17:05 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n069z-00B3ZX-OS for linux-arm-kernel@lists.infradead.org; Wed, 22 Dec 2021 18:16:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 045BA11B3; Wed, 22 Dec 2021 10:16:19 -0800 (PST) Received: from donnerap.arm.com (donnerap.cambridge.arm.com [10.1.196.172]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54AD33F5A1; Wed, 22 Dec 2021 10:16:18 -0800 (PST) From: Andre Przywara To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, Jaxson Han Subject: [boot-wrapper PATCH v2 3/9] Makefile: Tell compiler to generate bare-metal code Date: Wed, 22 Dec 2021 18:16:01 +0000 Message-Id: <20211222181607.1203191-4-andre.przywara@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222181607.1203191-1-andre.przywara@arm.com> References: <20211222181607.1203191-1-andre.przywara@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_101619_859614_5AF392C4 X-CRM114-Status: UNSURE ( 9.37 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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