[Skiboot] [PATCH] Honor DEAD_CODE_ELIMINATION flag

Mauro S. M. Rodrigues maurosr at linux.vnet.ibm.com
Fri Feb 28 04:14:47 AEDT 2020


While trying to reduce the size of the final binary I found
DEAD_CODE_ELIMINATION=1 but it didn't change the binary size and
known ununsed functions were seen when inspecting the elf with nm.

Even though the necessary parameters for compiler, -ffunction-sections
and -fdata-sections, are set, ld's --gc-sections wasn't, so add it in
order to honor the flag.

Signed-off-by: Mauro S. M. Rodrigues <maurosr at linux.vnet.ibm.com>
---
 Makefile.main | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.main b/Makefile.main
index 7ff2d21be..52251aa7e 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -171,6 +171,7 @@ endif
 
 ifeq ($(DEAD_CODE_ELIMINATION),1)
 LDFLAGS += -Wl,--gc-sections
+LDFLAGS_FINAL += --gc-sections
 endif
 
 AFLAGS := -D__ASSEMBLY__ -m64
-- 
2.24.1



More information about the Skiboot mailing list