From: Graeme Russ Date: Thu, 7 Oct 2010 09:03:32 +0000 (+1100) Subject: x86: Rearrange linker script X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=221914265860a47a0ba8bfa6956097cb045d9b39;p=u-boot.git x86: Rearrange linker script Tidy up the linker script and discard some sections to save space --- diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index e7a363da70..3e89ef4282 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -49,6 +49,7 @@ DECLARE_GLOBAL_DATA_PTR; /* Exports from the Linker Script */ extern ulong __text_start; +extern ulong __data_end; extern ulong __rel_dyn_start; extern ulong __rel_dyn_end; extern ulong __bss_start; @@ -170,7 +171,7 @@ gd_t *gd; void board_init_f (ulong gdp) { void *text_start = &__text_start; - void *u_boot_cmd_end = &__u_boot_cmd_end; + void *data_end = &__data_end; Elf32_Rel *rel_dyn_start = (Elf32_Rel *)&__rel_dyn_start; Elf32_Rel *rel_dyn_end = (Elf32_Rel *)&__rel_dyn_end; void *bss_start = &__bss_start; @@ -181,7 +182,7 @@ void board_init_f (ulong gdp) ulong rel_offset; Elf32_Rel *re; - uboot_size = (ulong)u_boot_cmd_end - (ulong)text_start; + uboot_size = (ulong)data_end - (ulong)text_start; dest_addr = (void *)gdp - (uboot_size + (ulong)bss_size); rel_offset = text_start - dest_addr; diff --git a/board/eNET/u-boot.lds b/board/eNET/u-boot.lds index ef5d9417a2..3c52010651 100644 --- a/board/eNET/u-boot.lds +++ b/board/eNET/u-boot.lds @@ -29,50 +29,47 @@ SECTIONS { . = TEXT_BASE; /* Location of bootcode in flash */ __text_start = .; - .text : { *(.text); } + .text : { *(.text*); } . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } - - . = ALIGN(4); - - .data : { *(.data) } + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } . = ALIGN(4); + __u_boot_cmd_end = .; - .interp : { *(.interp) } . = ALIGN(4); + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } - .dynsym : { *(.dynsym) } . = ALIGN(4); + .data : { *(.data*) } - .dynstr : { *(.dynstr) } . = ALIGN(4); + .dynsym : { *(.dynsym*) } - .hash : { *(.hash) } . = ALIGN(4); + .hash : { *(.hash*) } - .got : { *(.got) } . = ALIGN(4); + .got : { *(.got*) } - .got.plt : { *(.got.plt) } . = ALIGN(4); + __data_end = .; - .dynamic (NOLOAD) : { *(.dynamic) } . = ALIGN(4); + __bss_start = ABSOLUTE(.); + .bss (NOLOAD) : { *(.bss) } + __bss_size = SIZEOF(.bss); - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } . = ALIGN(4); - __u_boot_cmd_end = .; - __rel_dyn_start = .; .rel.dyn : { *(.rel.dyn) } __rel_dyn_end = .; - . = ALIGN(4); - __bss_start = ABSOLUTE(.); - .bss (NOLOAD) : { *(.bss) } - __bss_size = SIZEOF(.bss); + /DISCARD/ : { *(.dynstr*) } + /DISCARD/ : { *(.dynamic*) } + /DISCARD/ : { *(.plt*) } + /DISCARD/ : { *(.interp*) } + /DISCARD/ : { *(.gnu*) } /* 16bit realmode trampoline code */ .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }