From 22d3dc0d272c7294bfac2eb09f1b75c9622299b3 Mon Sep 17 00:00:00 2001 From: "Menon, Nishanth" Date: Mon, 12 May 2008 15:52:23 +0200 Subject: [PATCH] [arm] remove unsused sections while linking --- arch/arm/Makefile | 4 ++++ include/asm-generic/u-boot.lds.h | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index e3aac5d8b..f817906bf 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -22,6 +22,10 @@ TEXT_BASE = $(CONFIG_TEXT_BASE) CPPFLAGS += -mabi=apcs-gnu -DTEXT_BASE=$(TEXT_BASE) -P CFLAGS := -fno-common -msoft-float -Os +# Add cleanup flags +CPPFLAGS += -fdata-sections -ffunction-sections +LDFLAGS_uboot += -static --gc-sections + ifeq ($(incdir-y),) incdir-y := $(machine-y) endif diff --git a/include/asm-generic/u-boot.lds.h b/include/asm-generic/u-boot.lds.h index e24181a5c..e32ea5715 100644 --- a/include/asm-generic/u-boot.lds.h +++ b/include/asm-generic/u-boot.lds.h @@ -1,14 +1,14 @@ #define INITCALLS \ - *(.initcall.0) \ - *(.initcall.1) \ - *(.initcall.2) \ - *(.initcall.3) \ - *(.initcall.4) \ - *(.initcall.5) \ - *(.initcall.6) \ - *(.initcall.7) + KEEP(*(.initcall.0)) \ + KEEP(*(.initcall.1)) \ + KEEP(*(.initcall.2)) \ + KEEP(*(.initcall.3)) \ + KEEP(*(.initcall.4)) \ + KEEP(*(.initcall.5)) \ + KEEP(*(.initcall.6)) \ + KEEP(*(.initcall.7)) -#define U_BOOT_CMDS *(SORT_BY_NAME(.u_boot_cmd*)) +#define U_BOOT_CMDS KEEP(*(SORT_BY_NAME(.u_boot_cmd*))) -#define U_BOOT_SYMS *(__usymtab) +#define U_BOOT_SYMS KEEP(*(__usymtab))