From: Alexander Graf <agraf@suse.de>
Date: Mon, 23 Apr 2018 05:59:44 +0000 (+0200)
Subject: riscv: Enable function sections
X-Git-Tag: v2025.01-rc5-pxa1908~4178^2~21
X-Git-Url: http://git.dujemihanovic.xyz/img/html/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=6cc1a2af46c448e7d822fa4976a8d6e10fc5273b;p=u-boot.git

riscv: Enable function sections

The linker can remove sections that are never addressed, so it makes a lot
of sense to declare every function as an individual section.

This reduces the output U-Boot code size by ~30kb for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
---

diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
index a7448e2095..f65ed8725d 100644
--- a/arch/riscv/config.mk
+++ b/arch/riscv/config.mk
@@ -29,5 +29,5 @@ CONFIG_STANDALONE_LOAD_ADDR = 0x00000000 \
 			      -T $(srctree)/examples/standalone/riscv.lds
 
 PLATFORM_CPPFLAGS	+= -ffixed-gp -fpic
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2
+PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 -ffunction-sections
 LDFLAGS_u-boot += --gc-sections -static -pie