MIPS: Introduce --gc-sections for MIPS

All architectures but MIPS are using --gc-sections on final linking.
This patch introduces that feature for MIPS to reduce the memory and
flash footprint.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Thomas Lange <thomas@corelatus.se>
Cc: Vlad Lungu <vlad.lungu@windriver.com>
Signed-off-by: Shinya Kuribayashi <skuribay@pobox.com>
This commit is contained in:
Daniel Schwierzeck 2011-04-15 17:16:44 +02:00 committed by Shinya Kuribayashi
parent 7aa1f198c8
commit 660da0947a
9 changed files with 42 additions and 40 deletions

View file

@ -50,3 +50,5 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
PLATFORM_CPPFLAGS += -G 0 -mabicalls -fpic
PLATFORM_CPPFLAGS += -msoft-float
PLATFORM_LDFLAGS += -G 0 -static -n -nostdlib
PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
LDFLAGS_FINAL += --gc-sections

View file

@ -34,14 +34,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -52,7 +52,7 @@ SECTIONS
__got_end = .;
}
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
.u_boot_cmd : {
__u_boot_cmd_start = .;
@ -64,7 +64,7 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
.sbss (NOLOAD) : { *(.sbss*) }
.bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
uboot_end = .;
}

View file

@ -34,14 +34,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -52,7 +52,7 @@ SECTIONS
__got_end = .;
}
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
.u_boot_cmd : {
__u_boot_cmd_start = .;
@ -64,7 +64,7 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
.sbss (NOLOAD) : { *(.sbss*) }
.bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
uboot_end = .;
}

View file

@ -34,14 +34,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -52,7 +52,7 @@ SECTIONS
__got_end = .;
}
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
.u_boot_cmd : {
__u_boot_cmd_start = .;
@ -64,7 +64,7 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
.sbss (NOLOAD) : { *(.sbss*) }
.bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
uboot_end = .;
}

View file

@ -31,14 +31,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -50,7 +50,7 @@ SECTIONS
}
. = ALIGN(4);
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
. = ALIGN(4);
.u_boot_cmd : {
@ -64,8 +64,8 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss (NOLOAD) : { *(.sbss) }
.sbss (NOLOAD) : { *(.sbss*) }
. = ALIGN(4);
.bss (NOLOAD) : { *(.bss) }
.bss (NOLOAD) : { *(.bss*) }
uboot_end = .;
}

View file

@ -34,14 +34,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -52,7 +52,7 @@ SECTIONS
__got_end = .;
}
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
.u_boot_cmd : {
__u_boot_cmd_start = .;
@ -64,7 +64,7 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
.sbss (NOLOAD) : { *(.sbss*) }
.bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
uboot_end = .;
}

View file

@ -34,14 +34,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) +0x7ff0;
@ -53,7 +53,7 @@ SECTIONS
}
. = ALIGN(4);
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
. = .;
.u_boot_cmd : {
@ -66,7 +66,7 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss : { *(.sbss) }
.bss : { *(.bss) . = ALIGN(4); }
.sbss : { *(.sbss*) }
.bss : { *(.bss*) . = ALIGN(4); }
uboot_end = .;
}

View file

@ -34,14 +34,14 @@ SECTIONS
. = ALIGN(4);
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -52,7 +52,7 @@ SECTIONS
__got_end = .;
}
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
.u_boot_cmd : {
__u_boot_cmd_start = .;
@ -64,7 +64,7 @@ SECTIONS
num_got_entries = (__got_end - __got_start) >> 2;
. = ALIGN(4);
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
.sbss (NOLOAD) : { *(.sbss*) }
.bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
uboot_end = .;
}

View file

@ -30,14 +30,14 @@ SECTIONS
{
.text :
{
*(.text)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : { *(.data) }
.data : { *(.data*) }
. = .;
_gp = ALIGN(16) + 0x7ff0;
@ -48,12 +48,12 @@ SECTIONS
__got_end = .;
}
.sdata : { *(.sdata) }
.sdata : { *(.sdata*) }
. = ALIGN(4);
__bss_start = .;
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
.sbss (NOLOAD) : { *(.sbss*) }
.bss (NOLOAD) : { *(.bss*) . = ALIGN(4); }
_end = .;
}