]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
86xx: Use gc-sections to reduce image size
authorPeter Tyser <ptyser@xes-inc.com>
Wed, 29 Sep 2010 19:05:55 +0000 (14:05 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Wed, 20 Oct 2010 07:38:41 +0000 (02:38 -0500)
On an XPedite5170 over 11KBytes were saved:
  Before:
     text    data     bss     dec     hex filename
   319488   28700   33204  381392   5d1d0 ./u-boot

  After:
     text    data     bss     dec     hex filename
   307663   29144   33204  370011   5a55b ./u-boot

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/cpu/mpc86xx/config.mk
arch/powerpc/cpu/mpc86xx/u-boot.lds

index 7fae7e428663918749bf6d939621933635885d74..bce0fb374b999b854ec4119bc46a1f709e9d6073 100644 (file)
@@ -26,5 +26,9 @@ PLATFORM_RELFLAGS += -fPIC -meabi
 PLATFORM_CPPFLAGS += -ffixed-r2 -mstring
 PLATFORM_CPPFLAGS += -maltivec -mabi=altivec -msoft-float
 
+# Enable gc-sections to enable generation of smaller images.
+PLATFORM_LDFLAGS += --gc-sections
+PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+
 # Use default linker script.  Board port can override in board/*/config.mk
 LDSCRIPT := $(SRCTREE)/arch/powerpc/cpu/mpc86xx/u-boot.lds
index 4cea3b30f0fa80570e34f2b7f0009afdf96a1f8a..4bfcb9064199c265cbf7b9feeec9ed6b3d38d502 100644 (file)
@@ -60,19 +60,14 @@ SECTIONS
     lib/crc32.o (.text)
     arch/powerpc/lib/extable.o (.text)
     lib/zlib.o (.text)
-    *(.text)
-    *(.got1)
+    *(.text*)
    }
     _etext = .;
     PROVIDE (etext = .);
     .rodata    :
    {
-    *(.eh_frame)
     *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
   }
-  .fini      : { *(.fini)    } =0
-  .ctors     : { *(.ctors)   }
-  .dtors     : { *(.dtors)   }
 
   /* Read-write section, merged into data segment: */
   . = (. + 0x00FF) & 0xFFFFFF00;
@@ -80,23 +75,19 @@ SECTIONS
   PROVIDE (erotext = .);
   .reloc   :
   {
-    *(.got)
+    KEEP(*(.got))
     _GOT2_TABLE_ = .;
-    *(.got2)
+    KEEP(*(.got2))
     _FIXUP_TABLE_ = .;
-    *(.fixup)
+    KEEP(*(.fixup))
   }
   __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
   .data    :
   {
-    *(.data)
-    *(.data1)
-    *(.sdata)
-    *(.sdata2)
-    *(.dynamic)
-    CONSTRUCTORS
+    *(.data*)
+    *(.sdata*)
   }
   _edata  =  .;
   PROVIDE (edata = .);
@@ -121,9 +112,8 @@ SECTIONS
   __bss_start = .;
   .bss (NOLOAD)       :
   {
-   *(.sbss) *(.scommon)
-   *(.dynbss)
-   *(.bss)
+   *(.sbss*)
+   *(.bss*)
    *(COMMON)
    . = ALIGN(4);
   }