libdl: Add small data support to the remaining PowerPC BSPs.

Updates #3687
This commit is contained in:
Chris Johns
2019-03-06 21:15:56 +11:00
parent 96e4b22312
commit ec1dd51aae
8 changed files with 144 additions and 42 deletions

View File

@@ -27,6 +27,15 @@ RamBase = bsp_ram_start;
RamSize = bsp_ram_size; RamSize = bsp_ram_size;
HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0; HeapSize = DEFINED(HeapSize) ? HeapSize : 0x0;
/*
* The upper layer linker command file may optionally define the symbol
* bsp_section_small_data_area_size. By default, the small data area is
* defined by the .sdata and .sbss input sections. Define
* bsp_section_small_data_area_size, if you want to make space available for
* dynamically loaded libraries (libdl). Small memory targets which do not use
* libdl, should not define this symbol.
*/
MEMORY { MEMORY {
UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0 UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
} }
@@ -233,6 +242,7 @@ SECTIONS {
} > RAM } > RAM
.sdata : { .sdata : {
bsp_section_sdata_begin = .;
PROVIDE (_SDA_BASE_ = 32768); PROVIDE (_SDA_BASE_ = 32768);
*(.sdata .sdata.* .gnu.linkonce.s.*) *(.sdata .sdata.* .gnu.linkonce.s.*)
@@ -245,13 +255,14 @@ SECTIONS {
* BSP: End of data section * BSP: End of data section
*/ */
bsp_section_data_end = .; bsp_section_data_end = .;
bsp_section_sdata_end = .;
} > RAM } > RAM
.sbss : { .sbss : {
/* /*
* BSP: Start of bss section * BSP: Start of bss section
*/ */
bsp_section_bss_start = .; bsp_section_sbss_begin = .;
__bss_start = .; __bss_start = .;
@@ -260,11 +271,17 @@ SECTIONS {
*(.dynsbss) *(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*) *(.sbss .sbss.* .gnu.linkonce.sb.*)
PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
. = ALIGN (bsp_section_align); . = ALIGN (bsp_section_align);
} > RAM } > RAM
.bss : { .bss : {
bsp_section_bss_start = .;
*(COMMON) *(COMMON)
*(.dynbss) *(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*) *(.bss .bss.* .gnu.linkonce.b.*)

View File

@@ -24,6 +24,10 @@ MEMORY {
/*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/ /*FLASH : ORIGIN = 0xFFE00000, LENGTH = 16M*/
} }
/*
* Max sdata/bss.
*/
bsp_section_small_data_area_size = 65536;
SECTIONS SECTIONS
{ {
@@ -217,19 +221,27 @@ SECTIONS
.sdata : { .sdata : {
. = ALIGN (4); . = ALIGN (4);
PROVIDE (__SDATA_START__ = .); PROVIDE (__SDATA_START__ = .);
bsp_section_sdata_begin = .;
sdata.start = .; sdata.start = .;
*(.sdata*) *(.sdata*)
*(.gnu.linkonce.s.*) *(.gnu.linkonce.s.*)
sdata.end = .; sdata.end = .;
bsp_section_sdata_end = .;
} > RAM } > RAM
/* Zeroed small data addressed as offsets from r13 */ /* Zeroed small data addressed as offsets from r13 */
.sbss : { .sbss : {
. = ALIGN (4); . = ALIGN (4);
PROVIDE(__SBSS_START__ = .); PROVIDE(__SBSS_START__ = .);
bsp_section_sbss_begin = .;
sbss.start = .; sbss.start = .;
*(.sbss .sbss.* *.gnu.linkonce.sb.*); *(.sbss .sbss.* *.gnu.linkonce.sb.*);
sbss.end = .; sbss.end = .;
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
} > RAM } > RAM
PROVIDE(__SBSS_END__ = .); PROVIDE(__SBSS_END__ = .);

View File

@@ -100,7 +100,7 @@ SECTIONS
* end terminate with a NULL entry. * end terminate with a NULL entry.
*/ */
PROVIDE (__CTOR_LIST__ = .); PROVIDE (__CTOR_LIST__ = .);
/* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */ /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
*crtbegin.o(.ctors) *crtbegin.o(.ctors)
*(.ctors) *(.ctors)
@@ -227,28 +227,36 @@ SECTIONS
.fixup : { *(.fixup) } >ram .fixup : { *(.fixup) } >ram
PROVIDE (_FIXUP_END_ = .); PROVIDE (_FIXUP_END_ = .);
PROVIDE (__FIXUP_END__ = .); PROVIDE (__FIXUP_END__ = .);
.sdata : { .sdata : {
bsp_section_sdata_begin = .;
PROVIDE (_SDA_BASE_ = 32768); PROVIDE (_SDA_BASE_ = 32768);
*(.sdata .sdata.* .gnu.linkonce.s.*) *(.sdata .sdata.* .gnu.linkonce.s.*)
} > ram bsp_section_sdata_end = .;
} > ram
.sbss : { .sbss : {
__bss_start = .; __bss_start = .;
bsp_section_sbss_begin = .;
PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
*(.scommon) *(.scommon)
*(.dynsbss) *(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*) *(.sbss .sbss.* .gnu.linkonce.sb.*)
PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
} > ram } > ram
.sdata2 : { .sdata2 : {
PROVIDE (_SDA2_BASE_ = 32768); PROVIDE (_SDA2_BASE_ = 32768);
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*) *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
} > ram =0 } > ram =0
.sbss2 : { .sbss2 : {
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
} > ram =0 } > ram =0

View File

@@ -1,12 +1,23 @@
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc",
"elf32-powerpc") "elf32-powerpc")
OUTPUT_ARCH(powerpc) OUTPUT_ARCH(powerpc)
/* Do we need any of these for elf? /* Do we need any of these for elf?
__DYNAMIC = 0; */ __DYNAMIC = 0; */
MEMORY { MEMORY {
VECTORS : ORIGIN = 0x0 , LENGTH = 0x3000 VECTORS : ORIGIN = 0x0 , LENGTH = 0x3000
CODE : ORIGIN = 0x3000 , LENGTH = 32M - 0x3000 CODE : ORIGIN = 0x3000 , LENGTH = 32M - 0x3000
} }
/*
* The upper layer linker command file may optionally define the symbol
* bsp_section_small_data_area_size. By default, the small data area is
* defined by the .sdata and .sbss input sections. Define
* bsp_section_small_data_area_size, if you want to make space available for
* dynamically loaded libraries (libdl). Small memory targets which do not use
* libdl, should not define this symbol.
*/
SECTIONS SECTIONS
{ {
.entry_point_section : .entry_point_section :
@@ -215,11 +226,17 @@ SECTIONS
/* We want the small data sections together, so single-instruction offsets /* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */ we can shorten the on-disk segment size. */
.sdata : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata*) *(.gnu.linkonce.s.*) } >CODE .sdata : {
bsp_section_sdata_begin = .;
PROVIDE (_SDA_BASE_ = 32768);
*(.sdata*) *(.gnu.linkonce.s.*)
bsp_section_sdata_end = .;
} > CODE
_edata = .; _edata = .;
PROVIDE (edata = .); PROVIDE (edata = .);
.sbss : .sbss :
{ {
bsp_section_sbss_begin = .;
PROVIDE (__sbss_start = .); PROVIDE (__sbss_start = .);
*(.dynsbss) *(.dynsbss)
*(.sbss* .gnu.linkonce.sb.*) *(.sbss* .gnu.linkonce.sb.*)
@@ -230,6 +247,11 @@ SECTIONS
. += 1; . += 1;
PROVIDE (__SBSS_END__ = .); PROVIDE (__SBSS_END__ = .);
PROVIDE (__sbss_end = .); PROVIDE (__sbss_end = .);
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
} > CODE } > CODE
.plt : { *(.plt) } > CODE .plt : { *(.plt) } > CODE
.bss : .bss :

View File

@@ -15,7 +15,7 @@
*/ */
OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc") OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
OUTPUT_ARCH(powerpc) OUTPUT_ARCH(powerpc)
STARTUP(start.o) STARTUP(start.o)
ENTRY(start) ENTRY(start)
EXTERN(_vectors) EXTERN(_vectors)
@@ -35,14 +35,14 @@ SECTIONS
/* /*
* For the MPC555, we use the compressed vector table format which puts * For the MPC555, we use the compressed vector table format which puts
* all of the exception vectors before 0x100. * all of the exception vectors before 0x100.
*/ */
*(.vectors) *(.vectors)
} }
.text 0x100: .text 0x100:
{ {
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */
text.start = .; text.start = .;
/* Entry point is the .entry section */ /* Entry point is the .entry section */
@@ -54,7 +54,7 @@ SECTIONS
/* C++ constructors/destructors */ /* C++ constructors/destructors */
*(.gnu.linkonce.t*) *(.gnu.linkonce.t*)
/* Initialization and finalization code. /* Initialization and finalization code.
* *
* Various files can provide initialization and finalization functions. * Various files can provide initialization and finalization functions.
@@ -65,32 +65,32 @@ SECTIONS
* doesn't matter if the user does not actually link against ecrti.o and * doesn't matter if the user does not actually link against ecrti.o and
* ecrtn.o; the linker won't look for a file to match a wildcard. The * ecrtn.o; the linker won't look for a file to match a wildcard. The
* wildcard also means that it doesn't matter which directory ecrti.o * wildcard also means that it doesn't matter which directory ecrti.o
* and ecrtn.o are in. * and ecrtn.o are in.
*/ */
PROVIDE (_init = .); PROVIDE (_init = .);
*ecrti.o(.init) *ecrti.o(.init)
*(.init) *(.init)
*ecrtn.o(.init) *ecrtn.o(.init)
PROVIDE (_fini = .); PROVIDE (_fini = .);
*ecrti.o(.fini) *ecrti.o(.fini)
*(.fini) *(.fini)
*ecrtn.o(.init) *ecrtn.o(.init)
/* /*
* C++ constructors and destructors for static objects. * C++ constructors and destructors for static objects.
* PowerPC EABI does not use crtstuff yet, so we build "old-style" * PowerPC EABI does not use crtstuff yet, so we build "old-style"
* constructor and destructor lists that begin with the list length * constructor and destructor lists that begin with the list length
* end terminate with a NULL entry. * end terminate with a NULL entry.
*/ */
PROVIDE (__CTOR_LIST__ = .); PROVIDE (__CTOR_LIST__ = .);
/* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */ /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
*crtbegin.o(.ctors) *crtbegin.o(.ctors)
*(.ctors) *(.ctors)
*crtend.o(.ctors) *crtend.o(.ctors)
LONG(0) LONG(0)
PROVIDE (__CTOR_END__ = .); PROVIDE (__CTOR_END__ = .);
PROVIDE (__DTOR_LIST__ = .); PROVIDE (__DTOR_LIST__ = .);
/* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */ /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
*crtbegin.o(.dtors) *crtbegin.o(.dtors)
@@ -98,7 +98,7 @@ SECTIONS
*crtend.o(.dtors) *crtend.o(.dtors)
LONG(0) LONG(0)
PROVIDE (__DTOR_END__ = .); PROVIDE (__DTOR_END__ = .);
/* /*
* Special FreeBSD sysctl sections. * Special FreeBSD sysctl sections.
*/ */
@@ -139,8 +139,8 @@ SECTIONS
*(.tdata .tdata.* .gnu.linkonce.td.*) *(.tdata .tdata.* .gnu.linkonce.td.*)
_TLS_Data_end = .; _TLS_Data_end = .;
/* /*
* .data section contents, copied to RAM at system startup. * .data section contents, copied to RAM at system startup.
*/ */
. = ALIGN(0x20); . = ALIGN(0x20);
data.contents.start = .; data.contents.start = .;
@@ -163,37 +163,37 @@ SECTIONS
* internal RAM. * internal RAM.
*/ */
. = DEFINED(RTEMS_DEBUG) ? . : int_ram_org; . = DEFINED(RTEMS_DEBUG) ? . : int_ram_org;
.data : AT (data.contents.start) .data : AT (data.contents.start)
{ {
data.start = .; data.start = .;
*(.data) *(.data)
*(.data.*) *(.data.*)
KEEP (*(SORT(.rtemsrwset.*))) KEEP (*(SORT(.rtemsrwset.*)))
*(.data1) *(.data1)
PROVIDE (__SDATA_START__ = .); PROVIDE (__SDATA_START__ = .);
*(.sdata .sdata.* .gnu.linkonce.s.*) *(.sdata .sdata.* .gnu.linkonce.s.*)
PROVIDE (__SDATA_END__ = .); PROVIDE (__SDATA_END__ = .);
PROVIDE (__EXCEPT_START__ = .); PROVIDE (__EXCEPT_START__ = .);
*(.gcc_except_table*) *(.gcc_except_table*)
PROVIDE (__EXCEPT_END__ = .); PROVIDE (__EXCEPT_END__ = .);
PROVIDE(__GOT_START__ = .); PROVIDE(__GOT_START__ = .);
*(.got.plt) *(.got.plt)
*(.got) *(.got)
PROVIDE(__GOT_END__ = .); PROVIDE(__GOT_END__ = .);
*(.got1) *(.got1)
PROVIDE (__GOT2_START__ = .); PROVIDE (__GOT2_START__ = .);
PROVIDE (_GOT2_START_ = .); PROVIDE (_GOT2_START_ = .);
*(.got2) *(.got2)
PROVIDE (__GOT2_END__ = .); PROVIDE (__GOT2_END__ = .);
PROVIDE (_GOT2_END_ = .); PROVIDE (_GOT2_END_ = .);
PROVIDE (__FIXUP_START__ = .); PROVIDE (__FIXUP_START__ = .);
PROVIDE (_FIXUP_START_ = .); PROVIDE (_FIXUP_START_ = .);
*(.fixup) *(.fixup)
@@ -204,9 +204,11 @@ SECTIONS
* offsets can access them all. * offsets can access them all.
*/ */
PROVIDE (__SDATA2_START__ = .); PROVIDE (__SDATA2_START__ = .);
bsp_section_sdata_begin = .;
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*) *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
PROVIDE (__SDATA2_END__ = .); PROVIDE (__SDATA2_END__ = .);
bsp_section_sdata_end = .;
data.end = .; data.end = .;
} }
@@ -216,14 +218,20 @@ SECTIONS
.sbss : .sbss :
{ {
PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .); PROVIDE (__sbss_start = .); PROVIDE (___sbss_start = .);
bsp_section_sbss_begin = .;
*(.dynsbss) *(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*) *(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon) *(.scommon)
PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .); PROVIDE (__sbss_end = .); PROVIDE (___sbss_end = .);
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
} }
.bss : .bss :
{ {
*(.dynbss) *(.dynbss)
*(.bss .bss* .gnu.linkonce.b*) *(.bss .bss* .gnu.linkonce.b*)
*(COMMON) *(COMMON)
. = ALIGN(4); . = ALIGN(4);
@@ -247,9 +255,9 @@ SECTIONS
. = DEFINED(RTEMS_DEBUG) ? 0 + ext_ram_size : int_ram_top + ext_ram_size; . = DEFINED(RTEMS_DEBUG) ? 0 + ext_ram_size : int_ram_top + ext_ram_size;
WorkAreaBase = .; WorkAreaBase = .;
/* /*
* Internal I/O devices * Internal I/O devices
*/ */
.usiu 0x002FC000: /* unified system interface unit */ .usiu 0x002FC000: /* unified system interface unit */
{ {
@@ -283,22 +291,22 @@ SECTIONS
.stab.index 0 : { *(.stab.index) } .stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) } .stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) } .comment 0 : { *(.comment) }
/* DWARF debug sections. /* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */ of the section so we begin them at 0. */
/* DWARF 1 */ /* DWARF 1 */
.debug 0 : { *(.debug) } .debug 0 : { *(.debug) }
.line 0 : { *(.line) } .line 0 : { *(.line) }
/* GNU DWARF 1 extensions */ /* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) } .debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */ /* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) } .debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) } .debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */ /* DWARF 2 */
.debug_info 0 : { *(.debug_info) } .debug_info 0 : { *(.debug_info) }
.debug_abbrev 0 : { *(.debug_abbrev) } .debug_abbrev 0 : { *(.debug_abbrev) }
@@ -307,7 +315,7 @@ SECTIONS
.debug_str 0 : { *(.debug_str) } .debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) } .debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) } .debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */ /* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) } .debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) } .debug_funcnames 0 : { *(.debug_funcnames) }

View File

@@ -209,13 +209,18 @@ SECTIONS
* we can shorten the on-disk segment size. * we can shorten the on-disk segment size.
*/ */
/* Initialised small data addressed as offsets from r13 */ /* Initialised small data addressed as offsets from r13 */
.sdata : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*) } > RAM .sdata : {
bsp_section_sdata_begin = .;
PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*);
bsp_section_sdata_end = .;
} > RAM
_edata = .; _edata = .;
PROVIDE (edata = .); PROVIDE (edata = .);
/* Zeroed small data addressed as offsets from r13 */ /* Zeroed small data addressed as offsets from r13 */
.sbss : { PROVIDE (__sbss_start = .); .sbss : { PROVIDE (__sbss_start = .);
bsp_section_sbss_begin = .;
*(.dynsbss) *(.dynsbss)
*(.sbss*) *(.sbss*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
@@ -228,6 +233,11 @@ SECTIONS
PROVIDE (__SBSS_END__ = .); PROVIDE (__SBSS_END__ = .);
PROVIDE (__sbss_end = .); PROVIDE (__sbss_end = .);
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
} > RAM } > RAM
.plt : { *(.plt) } > RAM .plt : { *(.plt) } > RAM

View File

@@ -209,13 +209,18 @@ SECTIONS
* we can shorten the on-disk segment size. * we can shorten the on-disk segment size.
*/ */
/* Initialised small data addressed as offsets from r13 */ /* Initialised small data addressed as offsets from r13 */
.sdata : { PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*) } > RAM .sdata : {
bsp_section_sdata_begin = .;
PROVIDE (_SDA_BASE_ = 32768); *(.sdata* .gnu.linkonce.s.*);
bsp_section_sdata_end = .;
} > RAM
_edata = .; _edata = .;
PROVIDE (edata = .); PROVIDE (edata = .);
/* Zeroed small data addressed as offsets from r13 */ /* Zeroed small data addressed as offsets from r13 */
.sbss : { PROVIDE (__sbss_start = .); .sbss : { PROVIDE (__sbss_start = .);
bsp_section_sbss_begin = .;
*(.dynsbss) *(.dynsbss)
*(.sbss*) *(.sbss*)
*(.gnu.linkonce.sb.*) *(.gnu.linkonce.sb.*)
@@ -228,6 +233,11 @@ SECTIONS
PROVIDE (__SBSS_END__ = .); PROVIDE (__SBSS_END__ = .);
PROVIDE (__sbss_end = .); PROVIDE (__sbss_end = .);
bsp_section_sbss_end = .;
bsp_section_sdata_libdl_begin = .;
. = DEFINED(bsp_section_small_data_area_size) ?
bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
bsp_section_sdata_libdl_end = .;
} > RAM } > RAM
.plt : { *(.plt) } > RAM .plt : { *(.plt) } > RAM

View File

@@ -50,11 +50,16 @@ get_sda_base (void)
static void* static void*
get_sdata_start (void) get_sdata_start (void)
{ {
#if _ARCH_PPC64
return NULL;
#else
Elf_Addr addr; Elf_Addr addr;
GET_ADDR(__SDATA_START__, addr); GET_ADDR(__SDATA_START__, addr);
return (void*) addr; return (void*) addr;
#endif
} }
#if !_ARCH_PPC64
static size_t static size_t
get_sdata_sbss_size (void) get_sdata_sbss_size (void)
{ {
@@ -74,6 +79,7 @@ get_sdata_libdl_size (void)
GET_ADDR(bsp_section_sdata_libdl_end, end); GET_ADDR(bsp_section_sdata_libdl_end, end);
return end - begin; return end - begin;
} }
#endif
uint32_t uint32_t
rtems_rtl_elf_section_flags (const rtems_rtl_obj* obj, rtems_rtl_elf_section_flags (const rtems_rtl_obj* obj,
@@ -89,6 +95,7 @@ rtems_rtl_elf_arch_parse_section (const rtems_rtl_obj* obj,
const Elf_Shdr* shdr, const Elf_Shdr* shdr,
const uint32_t flags) const uint32_t flags)
{ {
#if !_ARCH_PPC64
struct { struct {
const char* label; const char* label;
size_t len; size_t len;
@@ -104,6 +111,7 @@ rtems_rtl_elf_arch_parse_section (const rtems_rtl_obj* obj,
if (strncmp (name, prefix[p].label, prefix[p].len) == 0) if (strncmp (name, prefix[p].label, prefix[p].len) == 0)
return flags | RTEMS_RTL_OBJ_SECT_ARCH_ALLOC; return flags | RTEMS_RTL_OBJ_SECT_ARCH_ALLOC;
} }
#endif
return flags; return flags;
} }
@@ -111,6 +119,10 @@ bool
rtems_rtl_elf_arch_section_alloc (const rtems_rtl_obj* obj, rtems_rtl_elf_arch_section_alloc (const rtems_rtl_obj* obj,
rtems_rtl_obj_sect* sect) rtems_rtl_obj_sect* sect)
{ {
#if _ARCH_PPC64
rtems_rtl_set_error (ENOMEM, ".sdata no supported by ABI");
return false;
#else
if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL)) if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL))
printf ("rtl: section: arch: alloc: name=%s size=%zu flags=%08" PRIx32 \ printf ("rtl: section: arch: alloc: name=%s size=%zu flags=%08" PRIx32 \
" order=%i link=%d info=%d\n", " order=%i link=%d info=%d\n",
@@ -138,16 +150,19 @@ rtems_rtl_elf_arch_section_alloc (const rtems_rtl_obj* obj,
} }
return true; return true;
#endif
} }
bool bool
rtems_rtl_elf_arch_section_free (const rtems_rtl_obj* obj, rtems_rtl_elf_arch_section_free (const rtems_rtl_obj* obj,
rtems_rtl_obj_sect* sect) rtems_rtl_obj_sect* sect)
{ {
#if !_ARCH_PPC64
if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL)) if (rtems_rtl_trace (RTEMS_RTL_TRACE_DETAIL))
printf ("rtl: section: arch: free: name=%s size=%zu\n", sect->name, sect->size); printf ("rtl: section: arch: free: name=%s size=%zu\n", sect->name, sect->size);
if (sdata != NULL) if (sdata != NULL)
rtems_rtl_bit_alloc_bfree (sdata, sect->base, sect->size); rtems_rtl_bit_alloc_bfree (sdata, sect->base, sect->size);
#endif
return true; return true;
} }