x86: Rearrange linker script
Tidy up the linker script and discard some sections to save space
This commit is contained in:
parent
067f9b1071
commit
2219142658
2 changed files with 32 additions and 34 deletions
|
@ -49,6 +49,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
/* Exports from the Linker Script */
|
/* Exports from the Linker Script */
|
||||||
extern ulong __text_start;
|
extern ulong __text_start;
|
||||||
|
extern ulong __data_end;
|
||||||
extern ulong __rel_dyn_start;
|
extern ulong __rel_dyn_start;
|
||||||
extern ulong __rel_dyn_end;
|
extern ulong __rel_dyn_end;
|
||||||
extern ulong __bss_start;
|
extern ulong __bss_start;
|
||||||
|
@ -170,7 +171,7 @@ gd_t *gd;
|
||||||
void board_init_f (ulong gdp)
|
void board_init_f (ulong gdp)
|
||||||
{
|
{
|
||||||
void *text_start = &__text_start;
|
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_start = (Elf32_Rel *)&__rel_dyn_start;
|
||||||
Elf32_Rel *rel_dyn_end = (Elf32_Rel *)&__rel_dyn_end;
|
Elf32_Rel *rel_dyn_end = (Elf32_Rel *)&__rel_dyn_end;
|
||||||
void *bss_start = &__bss_start;
|
void *bss_start = &__bss_start;
|
||||||
|
@ -181,7 +182,7 @@ void board_init_f (ulong gdp)
|
||||||
ulong rel_offset;
|
ulong rel_offset;
|
||||||
Elf32_Rel *re;
|
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);
|
dest_addr = (void *)gdp - (uboot_size + (ulong)bss_size);
|
||||||
rel_offset = text_start - dest_addr;
|
rel_offset = text_start - dest_addr;
|
||||||
|
|
||||||
|
|
|
@ -29,51 +29,48 @@ SECTIONS
|
||||||
{
|
{
|
||||||
. = TEXT_BASE; /* Location of bootcode in flash */
|
. = TEXT_BASE; /* Location of bootcode in flash */
|
||||||
__text_start = .;
|
__text_start = .;
|
||||||
.text : { *(.text); }
|
.text : { *(.text*); }
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.data : { *(.data) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.interp : { *(.interp) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.dynsym : { *(.dynsym) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.dynstr : { *(.dynstr) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.hash : { *(.hash) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.got : { *(.got) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.got.plt : { *(.got.plt) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
.dynamic (NOLOAD) : { *(.dynamic) }
|
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
__u_boot_cmd_start = .;
|
__u_boot_cmd_start = .;
|
||||||
.u_boot_cmd : { *(.u_boot_cmd) }
|
.u_boot_cmd : { *(.u_boot_cmd) }
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__u_boot_cmd_end = .;
|
__u_boot_cmd_end = .;
|
||||||
|
|
||||||
__rel_dyn_start = .;
|
. = ALIGN(4);
|
||||||
.rel.dyn : { *(.rel.dyn) }
|
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
|
||||||
__rel_dyn_end = .;
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
.data : { *(.data*) }
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
.dynsym : { *(.dynsym*) }
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
.hash : { *(.hash*) }
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
.got : { *(.got*) }
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
__data_end = .;
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__bss_start = ABSOLUTE(.);
|
__bss_start = ABSOLUTE(.);
|
||||||
.bss (NOLOAD) : { *(.bss) }
|
.bss (NOLOAD) : { *(.bss) }
|
||||||
__bss_size = SIZEOF(.bss);
|
__bss_size = SIZEOF(.bss);
|
||||||
|
|
||||||
|
. = ALIGN(4);
|
||||||
|
__rel_dyn_start = .;
|
||||||
|
.rel.dyn : { *(.rel.dyn) }
|
||||||
|
__rel_dyn_end = .;
|
||||||
|
|
||||||
|
/DISCARD/ : { *(.dynstr*) }
|
||||||
|
/DISCARD/ : { *(.dynamic*) }
|
||||||
|
/DISCARD/ : { *(.plt*) }
|
||||||
|
/DISCARD/ : { *(.interp*) }
|
||||||
|
/DISCARD/ : { *(.gnu*) }
|
||||||
|
|
||||||
/* 16bit realmode trampoline code */
|
/* 16bit realmode trampoline code */
|
||||||
.realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
|
.realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) { KEEP(*(.realmode)) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue