From cab410f7d913786e71c84f46fe7380d3320adcf1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 21 May 2013 14:19:24 +0200 Subject: bsps: Update due to linker changes In case the VMA and LMA regions differ, the LMA start address is now no longer aligned with the alignment of the input sections: http://sourceware.org/bugzilla/show_bug.cgi?id=15222 --- .../lib/libbsp/arm/shared/include/linker-symbols.h | 6 + c/src/lib/libbsp/arm/shared/include/start.h | 7 + c/src/lib/libbsp/arm/shared/startup/linkcmds.base | 180 ++++++++++-------- c/src/lib/libbsp/powerpc/qoriq/start/start.S | 12 ++ .../lib/libbsp/powerpc/qoriq/startup/mmu-config.c | 4 + .../libbsp/powerpc/shared/include/linker-symbols.h | 12 ++ .../libbsp/powerpc/shared/startup/linkcmds.base | 205 ++++++++++++--------- c/src/lib/libbsp/powerpc/t32mppc/start/start.S | 12 ++ 8 files changed, 268 insertions(+), 170 deletions(-) diff --git a/c/src/lib/libbsp/arm/shared/include/linker-symbols.h b/c/src/lib/libbsp/arm/shared/include/linker-symbols.h index cb83522695..57af053201 100644 --- a/c/src/lib/libbsp/arm/shared/include/linker-symbols.h +++ b/c/src/lib/libbsp/arm/shared/include/linker-symbols.h @@ -83,6 +83,12 @@ LINKER_SYMBOL(bsp_section_rodata_size) LINKER_SYMBOL(bsp_section_rodata_load_begin) LINKER_SYMBOL(bsp_section_rodata_load_end) +LINKER_SYMBOL(bsp_section_armexidx_begin) +LINKER_SYMBOL(bsp_section_armexidx_end) +LINKER_SYMBOL(bsp_section_armexidx_size) +LINKER_SYMBOL(bsp_section_armexidx_load_begin) +LINKER_SYMBOL(bsp_section_armexidx_load_end) + LINKER_SYMBOL(bsp_section_data_begin) LINKER_SYMBOL(bsp_section_data_end) LINKER_SYMBOL(bsp_section_data_size) diff --git a/c/src/lib/libbsp/arm/shared/include/start.h b/c/src/lib/libbsp/arm/shared/include/start.h index 3f5301c1a3..ec3d435522 100644 --- a/c/src/lib/libbsp/arm/shared/include/start.h +++ b/c/src/lib/libbsp/arm/shared/include/start.h @@ -99,6 +99,13 @@ BSP_START_TEXT_SECTION static inline void bsp_start_copy_sections(void) (size_t) bsp_section_rodata_size ); + /* Copy .ARM.exidx section */ + bsp_start_memcpy( + (int *) bsp_section_armexidx_begin, + (const int *) bsp_section_armexidx_load_begin, + (size_t) bsp_section_armexidx_size + ); + /* Copy .data section */ bsp_start_memcpy( (int *) bsp_section_data_begin, diff --git a/c/src/lib/libbsp/arm/shared/startup/linkcmds.base b/c/src/lib/libbsp/arm/shared/startup/linkcmds.base index dac0431381..2ef80a0a40 100644 --- a/c/src/lib/libbsp/arm/shared/startup/linkcmds.base +++ b/c/src/lib/libbsp/arm/shared/startup/linkcmds.base @@ -82,19 +82,22 @@ SECTIONS { bsp_section_fast_text_load_begin = LOADADDR (.fast_text); bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size; - .text : { + .text : ALIGN(32) { bsp_section_text_begin = .; + + /* .text */ *(.text.unlikely .text.*_unlikely) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) - } > REGION_TEXT AT > REGION_TEXT_LOAD - .init : { + + /* .init */ KEEP (*(.init)) - } > REGION_TEXT AT > REGION_TEXT_LOAD - .fini : { + + /* .fini */ KEEP (*(.fini)) + bsp_section_text_end = .; } > REGION_TEXT AT > REGION_TEXT_LOAD bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin; @@ -105,45 +108,48 @@ SECTIONS { . = ALIGN (bsp_section_robarrier_align); } > REGION_RODATA - .rodata : { + .rodata : ALIGN(32) { bsp_section_rodata_begin = .; + + /* .rodata */ *(.rodata .rodata.* .gnu.linkonce.r.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rodata1 : { + + /* .rodata1 */ *(.rodata1) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .ARM.extab : { + + /* .ARM.extab */ *(.ARM.extab* .gnu.linkonce.armextab.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .ARM.exidx : { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - } > REGION_RODATA AT > REGION_RODATA_LOAD - .eh_frame : { + + /* .eh_frame */ KEEP (*(.eh_frame)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gcc_except_table : { + + /* .gcc_except_table */ *(.gcc_except_table .gcc_except_table.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .preinit_array : { + + /* .tdata */ + *(.tdata .tdata.* .gnu.linkonce.td.*) + + /* .tbss */ + *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) + + /* .preinit_array */ PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .init_array : { + + /* .init_array */ PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array)) PROVIDE_HIDDEN (__init_array_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .fini_array : { + + /* .fini_array */ PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .ctors : { + + /* .ctors */ /* gcc uses crtbegin.o to find the start of the constructors, so we make sure it is first. Because this is a wildcard, it @@ -162,55 +168,55 @@ SECTIONS { KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dtors : { + + /* .dtors */ KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .data.rel.ro : { + + /* .data.rel.ro */ *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .jcr : { + + /* .jcr */ KEEP (*(.jcr)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dynamic : { + + /* .dynamic */ *(.dynamic) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .got : { + + /* .got */ *(.got.plt) *(.igot.plt) *(.got) *(.igot) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .interp : { + + /* .interp */ *(.interp) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .note.gnu.build-id : { + + /* .note.gnu.build-id */ *(.note.gnu.build-id) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .hash : { + + /* .hash */ *(.hash) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.hash : { + + /* .gnu.hash */ *(.gnu.hash) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dynsym : { + + /* .dynsym */ *(.dynsym) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dynstr : { + + /* .dynstr */ *(.dynstr) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.version : { + + /* .gnu.version */ *(.gnu.version) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.version_d : { + + /* .gnu.version_d */ *(.gnu.version_d) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.version_r : { + + /* .gnu.version_r */ *(.gnu.version_r) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rel.dyn : { + + /* .rel.dyn */ *(.rel.init) *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) *(.rel.fini) @@ -228,8 +234,8 @@ SECTIONS { PROVIDE_HIDDEN (__rel_iplt_end = .); PROVIDE_HIDDEN (__rela_iplt_start = .); PROVIDE_HIDDEN (__rela_iplt_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rela.dyn : { + + /* .rela.dyn */ *(.rela.init) *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) *(.rela.fini) @@ -246,20 +252,19 @@ SECTIONS { PROVIDE_HIDDEN (__rela_iplt_start = .); *(.rela.iplt) PROVIDE_HIDDEN (__rela_iplt_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rel.plt : { + + /* .rel.plt */ *(.rel.plt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rela.plt : { + + /* .rela.plt */ *(.rela.plt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .plt : { + + /* .plt */ *(.plt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .iplt : { + + /* .iplt */ *(.iplt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .robsdsets : { + /* Special FreeBSD linker set sections */ __start_set_sysctl_set = .; *(set_sysctl_*); @@ -279,6 +284,20 @@ SECTIONS { bsp_section_rodata_load_begin = LOADADDR (.rodata); bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size; + .ARM.exidx : ALIGN(32) { + bsp_section_armexidx_begin = .; + + /* .ARM.exidx */ + __exidx_start = .; + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + __exidx_end = .; + + bsp_section_armexidx_end = .; + } > REGION_RODATA AT > REGION_RODATA_LOAD + bsp_section_armexidx_size = bsp_section_armexidx_end - bsp_section_armexidx_begin; + bsp_section_armexidx_load_begin = LOADADDR (.ARM.exidx); + bsp_section_armexidx_load_end = bsp_section_armexidx_load_begin + bsp_section_armexidx_size; + .rwbarrier : { . = ALIGN (bsp_section_rwbarrier_align); } > REGION_DATA @@ -315,13 +334,14 @@ SECTIONS { bsp_stack_main_end = .; *(.bsp_vector) + bsp_section_vector_end = .; } > REGION_VECTOR AT > REGION_VECTOR bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_begin; bsp_vector_table_begin = DEFINED (bsp_vector_table_in_start_section) ? bsp_section_start_begin : bsp_section_vector_begin; bsp_vector_table_end = bsp_vector_table_begin + bsp_vector_table_size; - .fast_data : { + .fast_data : ALIGN(32) { bsp_section_fast_data_begin = .; *(.bsp_fast_data) bsp_section_fast_data_end = .; @@ -330,15 +350,16 @@ SECTIONS { bsp_section_fast_data_load_begin = LOADADDR (.fast_data); bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size; - .data : { + .data : ALIGN(32) { bsp_section_data_begin = .; + + /* .data */ *(.data .data.* .gnu.linkonce.d.*) SORT(CONSTRUCTORS) - } > REGION_DATA AT > REGION_DATA_LOAD - .data1 : { + + /* .data1 */ *(.data1) - } > REGION_DATA AT > REGION_DATA_LOAD - .rwbsdsets : { + /* Special FreeBSD linker set sections */ _bsd__start_set_sysinit_set = .; *(_bsd_set_sysinit_set); @@ -346,21 +367,18 @@ SECTIONS { bsp_section_data_end = .; } > REGION_DATA AT > REGION_DATA_LOAD - .tdata : { - *(.tdata .tdata.* .gnu.linkonce.td.*) - } > REGION_DATA AT > REGION_DATA_LOAD bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin; bsp_section_data_load_begin = LOADADDR (.data); bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size; - .tbss : { - *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - } > REGION_BSS AT > REGION_BSS .bss : { bsp_section_bss_begin = .; + + /* .bss */ *(.dynbss) *(.bss .bss.* .gnu.linkonce.b.*) *(COMMON) + bsp_section_bss_end = .; } > REGION_BSS AT > REGION_BSS bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin; diff --git a/c/src/lib/libbsp/powerpc/qoriq/start/start.S b/c/src/lib/libbsp/powerpc/qoriq/start/start.S index d95521c870..c4debf55c7 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/start/start.S +++ b/c/src/lib/libbsp/powerpc/qoriq/start/start.S @@ -83,6 +83,12 @@ _start: LWI r5, bsp_section_rodata_size bl copy + /* Copy small read-only data */ + LWI r3, bsp_section_sdata2_begin + LWI r4, bsp_section_sdata2_load_begin + LWI r5, bsp_section_sdata2_size + bl copy + /* Copy fast data */ LWI r3, bsp_section_fast_data_begin LWI r4, bsp_section_fast_data_load_begin @@ -95,6 +101,12 @@ _start: LWI r5, bsp_section_data_size bl copy + /* Copy small data */ + LWI r3, bsp_section_sdata_begin + LWI r4, bsp_section_sdata_load_begin + LWI r5, bsp_section_sdata_size + bl copy + /* NULL pointer access protection (only core 0 has to do this) */ mfspr r3, BOOKE_PIR cmpwi r3, 0 diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c b/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c index 676b8b9f57..3bcf17a7ba 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/mmu-config.c @@ -78,10 +78,14 @@ static const entry DATA config [] = { ENTRY_X(bsp_section_text_begin, bsp_section_text_size), ENTRY_R(bsp_section_rodata_load_begin, bsp_section_rodata_size), ENTRY_R(bsp_section_rodata_begin, bsp_section_rodata_size), + ENTRY_R(bsp_section_sdata2_load_begin, bsp_section_sdata2_size), + ENTRY_R(bsp_section_sdata2_begin, bsp_section_sdata2_size), ENTRY_R(bsp_section_fast_data_load_begin, bsp_section_fast_data_size), ENTRY_RW(bsp_section_fast_data_begin, bsp_section_fast_data_size), ENTRY_R(bsp_section_data_load_begin, bsp_section_data_size), ENTRY_RW(bsp_section_data_begin, bsp_section_data_size), + ENTRY_R(bsp_section_sdata_load_begin, bsp_section_sdata_size), + ENTRY_RW(bsp_section_sdata_begin, bsp_section_sdata_size), ENTRY_RW(bsp_section_sbss_begin, bsp_section_sbss_size), ENTRY_RW(bsp_section_bss_begin, bsp_section_bss_size), ENTRY_RW(bsp_section_rwextra_begin, bsp_section_rwextra_size), diff --git a/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h b/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h index 7bfc6e2304..77337ade26 100644 --- a/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h +++ b/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h @@ -61,6 +61,12 @@ LINKER_SYMBOL(bsp_section_rodata_size) LINKER_SYMBOL(bsp_section_rodata_load_begin) LINKER_SYMBOL(bsp_section_rodata_load_end) +LINKER_SYMBOL(bsp_section_sdata2_begin) +LINKER_SYMBOL(bsp_section_sdata2_end) +LINKER_SYMBOL(bsp_section_sdata2_size) +LINKER_SYMBOL(bsp_section_sdata2_load_begin) +LINKER_SYMBOL(bsp_section_sdata2_load_end) + LINKER_SYMBOL(bsp_section_fast_data_begin) LINKER_SYMBOL(bsp_section_fast_data_end) LINKER_SYMBOL(bsp_section_fast_data_size) @@ -73,6 +79,12 @@ LINKER_SYMBOL(bsp_section_data_size) LINKER_SYMBOL(bsp_section_data_load_begin) LINKER_SYMBOL(bsp_section_data_load_end) +LINKER_SYMBOL(bsp_section_sdata_begin) +LINKER_SYMBOL(bsp_section_sdata_end) +LINKER_SYMBOL(bsp_section_sdata_size) +LINKER_SYMBOL(bsp_section_sdata_load_begin) +LINKER_SYMBOL(bsp_section_sdata_load_end) + LINKER_SYMBOL(bsp_section_bss_begin) LINKER_SYMBOL(bsp_section_bss_end) LINKER_SYMBOL(bsp_section_bss_size) diff --git a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base index b66f21c005..ab12dba7be 100644 --- a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base +++ b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. + * Copyright (c) 2011-2013 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -51,27 +51,31 @@ SECTIONS { . = ALIGN (bsp_section_xbarrier_align); } > REGION_TEXT - .text : { + .text : ALIGN(32) { bsp_section_text_begin = .; + *(SORT(.bsp_text*)) + + /* .text */ *(.text.unlikely .text.*_unlikely) *(.text .stub .text.* .gnu.linkonce.t.*) *(.gnu.warning) *(.glink) - } > REGION_TEXT AT > REGION_TEXT_LOAD - .init : { + + /* .init */ KEEP (*(.init)) - } > REGION_TEXT AT > REGION_TEXT_LOAD - .fini : { + + /* .fini */ PROVIDE (_fini = .); KEEP (*(.fini)) + bsp_section_text_end = .; } > REGION_TEXT AT > REGION_TEXT_LOAD bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin; bsp_section_text_load_begin = LOADADDR (.text); bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size; - .fast_text : { + .fast_text : ALIGN(32) { bsp_section_fast_text_begin = .; *(.bsp_fast_text) bsp_section_fast_text_end = .; @@ -84,122 +88,118 @@ SECTIONS { . = ALIGN (bsp_section_robarrier_align); } > REGION_RODATA - .rodata : { + .rodata : ALIGN(32) { bsp_section_rodata_begin = .; + *(SORT(.bsp_rodata*)) + + /* .rodata */ *(.rodata .rodata.* .gnu.linkonce.r.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rodata1 : { + + /* .rodata1 */ *(.rodata1) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .sdata2 : { - PROVIDE (_SDA2_BASE_ = 32768); - *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .sbss2 : { - *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .eh_frame_hdr : { + + /* .eh_frame_hdr */ *(.eh_frame_hdr) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .eh_frame : { + + /* .eh_frame */ KEEP (*(.eh_frame)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gcc_except_table : { + + /* .gcc_except_table */ *(.gcc_except_table .gcc_except_table.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .tdata : { + + /* .tdata */ *(.tdata .tdata.* .gnu.linkonce.td.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .tbss : { + + /* .tbss */ *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .preinit_array : { + + /* .preinit_array */ PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array)) PROVIDE_HIDDEN (__preinit_array_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .init_array : { + + /* .init_array */ PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array)) PROVIDE_HIDDEN (__init_array_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .fini_array : { + + /* .fini_array */ PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array)) PROVIDE_HIDDEN (__fini_array_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .ctors : { + + /* .ctors */ KEEP (*crtbegin.o(.ctors)) KEEP (*crtbegin?.o(.ctors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dtors : { + + /* .dtors */ KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .jcr : { + + /* .jcr */ KEEP (*(.jcr)) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .data.rel.ro : { + + /* .data.rel.ro */ *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .fixup : { + + /* .fixpup */ *(.fixup) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dynamic : { + + /* .dynamic */ *(.dynamic) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .got1 : { + + /* .got1 */ *(.got1) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .got2 : { + + /* .got2 */ *(.got2) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .got : { + + /* .got */ *(.got) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .plt : { + + /* .plt */ *(.plt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .iplt : { + + /* .iptl */ *(.iplt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .interp : { + + /* .interp */ *(.interp) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .note.gnu.build-id : { + + /* .note.gnu.build-id */ *(.note.gnu.build-id) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .hash : { + + /* .hash */ *(.hash) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.hash : { + + /* .gnu.hash */ *(.gnu.hash) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dynsym : { + + /* .dynsym */ *(.dynsym) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .dynstr : { + + /* .dynstr */ *(.dynstr) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.version : { + + /* .gnu.version */ *(.gnu.version) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.version_d : { + + /* .gnu.version_d */ *(.gnu.version_d) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .gnu.version_r : { + + /* .gnu.version_r */ *(.gnu.version_r) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rela.dyn : { + + /* .rela.dyn */ *(.rela.init) *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) *(.rela.fini) @@ -222,11 +222,10 @@ SECTIONS { PROVIDE_HIDDEN (__rela_iplt_start = .); *(.rela.iplt) PROVIDE_HIDDEN (__rela_iplt_end = .); - } > REGION_RODATA AT > REGION_RODATA_LOAD - .rela.plt : { + + /* .rela.plt */ *(.rela.plt) - } > REGION_RODATA AT > REGION_RODATA_LOAD - .robsdsets : { + /* Special FreeBSD linker set sections */ __start_set_sysctl_set = .; *(set_sysctl_*); @@ -246,11 +245,27 @@ SECTIONS { bsp_section_rodata_load_begin = LOADADDR (.rodata); bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size; + .sdata2 : ALIGN(32) { + bsp_section_sdata2_begin = .; + + /* .sdata2 */ + PROVIDE (_SDA2_BASE_ = 32768); + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + + /* .sbss2 */ + *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) + + bsp_section_sdata2_end = .; + } > REGION_RODATA AT > REGION_RODATA_LOAD + bsp_section_sdata2_size = bsp_section_sdata2_end - bsp_section_sdata2_begin; + bsp_section_sdata2_load_begin = LOADADDR (.sdata2); + bsp_section_sdata2_load_end = bsp_section_sdata2_load_begin + bsp_section_sdata2_size; + .rwbarrier : { . = ALIGN (bsp_section_rwbarrier_align); } > REGION_DATA - .fast_data : { + .fast_data : ALIGN(32) { bsp_section_fast_data_begin = .; *(SORT(.bsp_fast_data*)) bsp_section_fast_data_end = .; @@ -259,30 +274,42 @@ SECTIONS { bsp_section_fast_data_load_begin = LOADADDR (.fast_data); bsp_section_fast_data_load_end = bsp_section_fast_data_load_begin + bsp_section_fast_data_size; - .data : { + .data : ALIGN(32) { bsp_section_data_begin = .; + *(SORT(.bsp_data*)) + + /* .data */ *(.data .data.* .gnu.linkonce.d.*) SORT(CONSTRUCTORS) - } > REGION_DATA AT > REGION_DATA_LOAD - .data1 : { + + /* .data1 */ *(.data1) - } > REGION_DATA AT > REGION_DATA_LOAD - .rwbsdsets : { + /* Special FreeBSD linker set sections */ _bsd__start_set_sysinit_set = .; *(_bsd_set_sysinit_set); _bsd__stop_set_sysinit_set = .; - } > REGION_DATA AT > REGION_DATA_LOAD - .sdata : { - PROVIDE (_SDA_BASE_ = 32768); - *(.sdata .sdata.* .gnu.linkonce.s.*) + bsp_section_data_end = .; } > REGION_DATA AT > REGION_DATA_LOAD bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin; bsp_section_data_load_begin = LOADADDR (.data); bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size; + .sdata : ALIGN(32) { + bsp_section_sdata_begin = .; + + /* .sdata */ + PROVIDE (_SDA_BASE_ = 32768); + *(.sdata .sdata.* .gnu.linkonce.s.*) + + bsp_section_sdata_end = .; + } > REGION_DATA AT > REGION_DATA_LOAD + bsp_section_sdata_size = bsp_section_sdata_end - bsp_section_sdata_begin; + bsp_section_sdata_load_begin = LOADADDR (.sdata); + bsp_section_sdata_load_end = bsp_section_sdata_load_begin + bsp_section_sdata_size; + .sbss : { bsp_section_sbss_begin = .; *(.dynsbss) diff --git a/c/src/lib/libbsp/powerpc/t32mppc/start/start.S b/c/src/lib/libbsp/powerpc/t32mppc/start/start.S index 466e42f3b4..6c505de771 100644 --- a/c/src/lib/libbsp/powerpc/t32mppc/start/start.S +++ b/c/src/lib/libbsp/powerpc/t32mppc/start/start.S @@ -46,6 +46,12 @@ _start: LWI r5, bsp_section_rodata_size bl copy + /* Copy small read-only data */ + LWI r3, bsp_section_sdata2_begin + LWI r4, bsp_section_sdata2_load_begin + LWI r5, bsp_section_sdata2_size + bl copy + /* Copy fast data */ LWI r3, bsp_section_fast_data_begin LWI r4, bsp_section_fast_data_load_begin @@ -58,6 +64,12 @@ _start: LWI r5, bsp_section_data_size bl copy + /* Copy small data */ + LWI r3, bsp_section_sdata_begin + LWI r4, bsp_section_sdata_load_begin + LWI r5, bsp_section_sdata_size + bl copy + /* Clear SBSS */ LWI r3, bsp_section_sbss_begin LWI r4, bsp_section_sbss_size -- cgit v1.2.3