From patchwork Tue Dec 19 03:31:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang W X-Patchwork-Id: 1877717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=n1EzKYiv; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=BIcxnGFc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvMhd56P6z20H4 for ; Tue, 19 Dec 2023 14:32:49 +1100 (AEDT) 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: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:In-Reply-To:References: List-Owner; bh=EfbgOY/BZ5tZPsndOv3GLLs3tDE2pVpNNbBpXw3bUGo=; b=n1EzKYiv9TBXiU agU20UXjtcv/7aouJ/4kOcQjod04fC7snIQVN5SL0Kun1S3Zp0Ak6bUQpl9aS8wEpQNkNpGonwSyP Z0w8/EAIg+VTVzo+nCtyjQl0fwxSBuAPjdguXYnC4dgr+LUevrrFQAz7VcjRcqMEQc1JXJbPd7MLf iZTP28NNfCuEldh3W3e7HJgNH+SmtCARuq2yNhdkvznI7TQ//YHbWwOdt1Jv1+6i8u0zHa+apGQsL QJZI1NviEUoLUzLw9ZlNWiwlF8pi5ZfS4vf2xChFi+1qLz83BqIjWL1yHf4ToeU7+sC0JWWMMBCAq UnGVK4JVU+q+PwKnY3xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rFQqQ-00Ch3V-15; Tue, 19 Dec 2023 03:32:34 +0000 Received: from m126.mail.126.com ([220.181.12.37]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rFQqN-00Ch1I-1J for opensbi@lists.infradead.org; Tue, 19 Dec 2023 03:32:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=spOcN +sg04cDAoLjiVjET6KDQocsm+eBioGH7o2P6jk=; b=BIcxnGFc1kWrzLVpVcSuW dSWDWo0r0od4AUBsWiypPXH/zl7DSU4Uurnx4HKH9pCq9XpF7vnixG7Zyp2t7+Ci N9OUMr9IJ2jMC/PaG6v381/AQidiyIvj1mnj5IyqRwz9DTc1EJVeUMgmD5RpN8nc ggk9l9Cyjc8V9pxxV0ZH4U= Received: from T490.lan (unknown [112.83.182.199]) by zwqz-smtp-mta-g5-0 (Coremail) with SMTP id _____wA3nz3DDoFlmuXwEA--.1323S2; Tue, 19 Dec 2023 11:32:20 +0800 (CST) From: Xiang W To: opensbi@lists.infradead.org Cc: Xiang W Subject: [PATCH] Makefile: Remove unused code and data Date: Tue, 19 Dec 2023 11:31:59 +0800 Message-ID: <20231219033217.181779-1-wxjstz@126.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CM-TRANSID: _____wA3nz3DDoFlmuXwEA--.1323S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7XF47CryfAryfZw1xXw13Arb_yoWDCFb_Ka 97C3WxKr45AFs2qa1UCFZ7Gr1rAr90gr13AF18t3y0yryUtan0va9rAr1fZF4FqF47Wr1F 9F95XFyagryxtjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xREwvK5UUUUU== X-Originating-IP: [112.83.182.199] X-CM-SenderInfo: pz0m23b26rjloofrz/xtbBcwdLOmSQAdw3hQABsf X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231218_193231_806586_C322948E X-CRM114-Status: UNSURE ( 6.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add compiler options to create separate sections for functions and static variables. And add options to the linker to remove unused sections. Signed-off-by: Xiang W --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [wxjstz[at]126.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add compiler options to create separate sections for functions and static variables. And add options to the linker to remove unused sections. Signed-off-by: Xiang W --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index de4e73a..fbb64f2 100644 --- a/Makefile +++ b/Makefile @@ -331,7 +331,7 @@ GENFLAGS += $(libsbiutils-genflags-y) GENFLAGS += $(platform-genflags-y) GENFLAGS += $(firmware-genflags-y) -CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing +CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-stack-protector -fno-strict-aliasing -ffunction-sections -fdata-sections ifneq ($(DEBUG),) CFLAGS += -O0 else @@ -377,6 +377,7 @@ ARFLAGS = rcs ELFFLAGS += $(USE_LD_FLAG) ELFFLAGS += -Wl,--exclude-libs,ALL ELFFLAGS += -Wl,--build-id=none +ELFFLAGS += -Wl,--gc-sections ELFFLAGS += $(platform-ldflags-y) ELFFLAGS += $(firmware-ldflags-y)