[arch] further linker script cleanup

-added COMMON support
-remove SUBALIGN, which was being incorrectly used
-better align sections
This commit is contained in:
Travis Geiselbrecht
2013-01-12 20:30:22 -08:00
parent 806a590753
commit 5c6b69d313
3 changed files with 70 additions and 55 deletions

View File

@@ -7,10 +7,12 @@ SECTIONS
. = %MEMBASE%;
/* text/read-only data */
.text.boot.vectab1 : { KEEP(*(.text.boot.vectab1)) }
.text.boot.vectab2 : { KEEP(*(.text.boot.vectab2)) }
.text.boot : { KEEP(*(.text.boot)) }
.text : { *(.text .text.* .sram.text .glue_7* .gnu.linkonce.t.*) } =0x9090
.text : {
KEEP(*(.text.boot.vectab1))
KEEP(*(.text.boot.vectab2))
KEEP(*(.text.boot))
*(.text* .sram.text.glue_7* .gnu.linkonce.t.*)
}
.interp : { *(.interp) }
.hash : { *(.hash) }
@@ -44,17 +46,19 @@ SECTIONS
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
__exidx_end = .;
.rodata : {
.rodata : ALIGN(4) {
__rodata_start = .;
*(.rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(4);
__rodata_end = . ;
__rodata_end = .;
}
/* writable data */
__data_start_rom = .;
/* in one segment binaries, the rom data address is on top of the ram data address */
__data_start = .;
.data : SUBALIGN(4) {
.data : ALIGN(4) {
/* writable data */
__data_start_rom = .;
/* in one segment binaries, the rom data address is on top of the ram data address */
__data_start = .;
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
__commands_start = .;
@@ -66,26 +70,32 @@ SECTIONS
__apps_end = .;
}
__ctor_list = .;
.ctors : { *(.ctors) }
__ctor_end = .;
__dtor_list = .;
.dtors : { *(.dtors) }
__dtor_end = .;
.ctors : ALIGN(4) {
__ctor_list = .;
*(.ctors)
__ctor_end = .;
}
.dtors : ALIGN(4) {
__dtor_list = .;
*(.dtors)
__dtor_end = .;
}
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) }
__data_end = .;
/* unintialized data (in same segment as writable data) */
.prebss : SUBALIGN(4) { KEEP(*(.bss.prebss.*)) }
.bss.initial_stack : SUBALIGN(4) { KEEP(*(.bss.initial_stack)) }
.bss : SUBALIGN(4) {
.bss : ALIGN(4) {
KEEP(*(.bss.prebss.*))
. = ALIGN(4);
__bss_start = .;
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
}
. = ALIGN(4);
__bss_end = .;
_end = .;

View File

@@ -7,10 +7,12 @@ SECTIONS
. = %ROMBASE%;
/* text/read-only data */
.text.boot.vectab1 : { KEEP(*(.text.boot.vectab1)) }
.text.boot.vectab2 : { KEEP(*(.text.boot.vectab2)) }
.text.boot : { KEEP(*(.text.boot)) }
.text : { *(.text .text.* .glue_7* .gnu.linkonce.t.*) } =0x9090
.text : {
KEEP(*(.text.boot.vectab1))
KEEP(*(.text.boot.vectab2))
KEEP(*(.text.boot))
*(.text* .sram.text.glue_7* .gnu.linkonce.t.*)
}
.interp : { *(.interp) }
.hash : { *(.hash) }
@@ -44,18 +46,21 @@ SECTIONS
.ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
__exidx_end = .;
.rodata : {
.rodata : ALIGN(4) {
__rodata_start = .;
*(.rodata .rodata.* .gnu.linkonce.r.*)
. = ALIGN(4);
__rodata_end = . ;
__rodata_end = .;
}
/* writable data */
__data_start_rom = .;
/* in two segment binaries, the data starts at the bottom of ram (MEMBASE) */
. = %MEMBASE%;
__data_start = .;
.data : AT ( ADDR (.rodata) + SIZEOF (.rodata) ) {
.data : AT ( ADDR (.rodata) + SIZEOF (.rodata) ) ALIGN(4) {
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
__commands_start = .;
@@ -68,29 +73,35 @@ SECTIONS
}
/* code that is located in ram */
.sram.text : {
.sram.text : ALIGN(4) {
KEEP (*(.sram.text*))
}
__ctor_list = .;
.ctors : { *(.ctors) }
__ctor_end = .;
__dtor_list = .;
.dtors : { *(.dtors) }
__dtor_end = .;
.ctors : ALIGN(4) {
__ctor_list = .;
*(.ctors)
__ctor_end = .;
}
.dtors : ALIGN(4) {
__dtor_list = .;
*(.dtors)
__dtor_end = .;
}
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) }
__data_end = .;
/* unintialized data (in same segment as writable data) */
.bss.initial_stack : SUBALIGN(4) { KEEP(*(.bss.initial_stack)) }
.bss : SUBALIGN(4) {
.bss : ALIGN(4) {
KEEP(*(.bss.prebss.*))
. = ALIGN(4);
__bss_start = .;
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
}
. = ALIGN(4);
__bss_end = .;
_end = .;

View File

@@ -36,9 +36,8 @@ SECTIONS
*(.gnu.linkonce.r.*)
}
. = ALIGN(4096);
__data_start = .;
.data : {
.data : ALIGN(4096) {
__data_start = .;
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN(4);
__commands_start = .;
@@ -56,24 +55,19 @@ SECTIONS
.dtors : { *(.dtors) }
__dtor_end = .;
.stab : { *(.stab) }
.stabst : { *(.stabstr) }
.stab : { *(.stab) }
.stabst : { *(.stabstr) }
. = ALIGN(4096);
__data_end = .;
__bss_start = .;
.bss : {
.bss : ALIGN(4) {
__bss_start = .;
*(.bss*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
__bss_end = .;
}
. = ALIGN(4096);
__bss_end = .;
/*. += 0x2000;
_kstack = .;
. += 0x1000;*/
_end = .;