From b618d8cfc54f84d4ed03dc7b7fa510c872e6128a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 16 Sep 2015 07:13:58 +0200 Subject: Add RTEMS linker sets Update #2408. --- c/src/lib/libbsp/arm/gba/startup/linkcmds | 2 + c/src/lib/libbsp/avr/avrtest/startup/linkcmds | 2 + c/src/lib/libbsp/bfin/TLL6527M/startup/linkcmds | 2 + c/src/lib/libbsp/bfin/bf537Stamp/startup/linkcmds | 2 + c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds | 2 + c/src/lib/libbsp/h8300/h8sim/startup/linkcmds | 2 + c/src/lib/libbsp/lm32/lm32_evr/startup/linkcmds | 3 +- c/src/lib/libbsp/lm32/milkymist/startup/linkcmds | 3 +- c/src/lib/libbsp/m32c/m32cbsp/startup/linkcmds | 3 +- c/src/lib/libbsp/m32r/m32rsim/startup/linkcmds | 3 +- c/src/lib/libbsp/m68k/av5282/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/av5282/startup/linkcmdsflash | 2 + c/src/lib/libbsp/m68k/av5282/startup/linkcmdsram | 2 + c/src/lib/libbsp/m68k/csb360/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/gen68302/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/gen68340/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/gen68360/startup/linkcmds | 2 + .../libbsp/m68k/gen68360/startup/linkcmds.bootp | 2 + .../lib/libbsp/m68k/gen68360/startup/linkcmds.prom | 2 + c/src/lib/libbsp/m68k/idp/startup/linkcmds | 2 + .../lib/libbsp/m68k/mcf5206elite/startup/linkcmds | 2 + .../m68k/mcf5206elite/startup/linkcmds.flash | 2 + c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mcf5225x/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds | 2 + .../lib/libbsp/m68k/mcf5235/startup/linkcmdsflash | 2 + c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram | 2 + c/src/lib/libbsp/m68k/mcf5329/startup/linkcmds | 2 + .../lib/libbsp/m68k/mcf5329/startup/linkcmdsflash | 2 + c/src/lib/libbsp/m68k/mrm332/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mvme136/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mvme147/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mvme147s/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mvme162/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/mvme167/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/ods68302/startup/debugger | 2 + c/src/lib/libbsp/m68k/ods68302/startup/linkcmds | 2 + c/src/lib/libbsp/m68k/ods68302/startup/rom | 2 + c/src/lib/libbsp/m68k/uC5282/startup/linkcmds | 2 + c/src/lib/libbsp/mips/csb350/startup/linkcmds | 2 + .../lib/libbsp/mips/genmongoosev/startup/linkcmds | 2 + c/src/lib/libbsp/mips/hurricane/startup/linkcmds | 2 + c/src/lib/libbsp/mips/rbtx4925/startup/linkcmds | 2 + c/src/lib/libbsp/mips/rbtx4938/startup/linkcmds | 2 + c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds | 3 +- c/src/lib/libbsp/nios2/nios2_iss/startup/linkcmds | 3 +- c/src/lib/libbsp/powerpc/beatnik/startup/linkcmds | 3 +- c/src/lib/libbsp/powerpc/ep1a/startup/linkcmds | 3 +- .../libbsp/powerpc/gen5200/startup/linkcmds.base | 2 + .../lib/libbsp/powerpc/haleakala/startup/linkcmds | 2 + c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds | 2 + .../lib/libbsp/powerpc/mpc8260ads/startup/linkcmds | 2 + c/src/lib/libbsp/powerpc/qemuppc/startup/linkcmds | 3 +- .../lib/libbsp/powerpc/score603e/startup/linkcmds | 3 +- c/src/lib/libbsp/powerpc/shared/startup/linkcmds | 3 +- c/src/lib/libbsp/powerpc/ss555/startup/linkcmds | 2 + .../libbsp/powerpc/tqm8xx/startup/linkcmds.base | 3 +- c/src/lib/libbsp/powerpc/virtex4/startup/linkcmds | 3 +- c/src/lib/libbsp/powerpc/virtex5/startup/linkcmds | 3 +- c/src/lib/libbsp/sh/gensh1/startup/linkcmds | 3 +- c/src/lib/libbsp/sh/gensh2/startup/linkcmds | 3 +- c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram | 3 +- c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom | 3 +- c/src/lib/libbsp/sh/gensh4/startup/linkcmds | 2 + c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom | 2 + .../lib/libbsp/sh/gensh4/startup/linkcmds.rom2ram | 2 + c/src/lib/libbsp/sh/shsim/startup/linkcmds.sim | 3 +- c/src/lib/libbsp/sparc64/shared/startup/linkcmds | 2 + c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds | 3 +- cpukit/score/Makefile.am | 1 + cpukit/score/include/rtems/linkersets.h | 96 +++++ cpukit/score/preinstall.am | 4 + doc/user/Makefile.am | 9 +- doc/user/c_user.texi | 2 + doc/user/example.texi | 2 +- doc/user/linkersets.t | 421 +++++++++++++++++++++ testsuites/sptests/Makefile.am | 1 + testsuites/sptests/configure.ac | 1 + testsuites/sptests/splinkersets01/Makefile.am | 23 ++ testsuites/sptests/splinkersets01/init.c | 152 ++++++++ testsuites/sptests/splinkersets01/items.c | 23 ++ testsuites/sptests/splinkersets01/sets.c | 23 ++ .../sptests/splinkersets01/splinkersets01.doc | 25 ++ testsuites/sptests/splinkersets01/splinkersets01.h | 40 ++ .../sptests/splinkersets01/splinkersets01.scn | 2 + 85 files changed, 960 insertions(+), 23 deletions(-) create mode 100644 cpukit/score/include/rtems/linkersets.h create mode 100644 doc/user/linkersets.t create mode 100644 testsuites/sptests/splinkersets01/Makefile.am create mode 100644 testsuites/sptests/splinkersets01/init.c create mode 100644 testsuites/sptests/splinkersets01/items.c create mode 100644 testsuites/sptests/splinkersets01/sets.c create mode 100644 testsuites/sptests/splinkersets01/splinkersets01.doc create mode 100644 testsuites/sptests/splinkersets01/splinkersets01.h create mode 100644 testsuites/sptests/splinkersets01/splinkersets01.scn diff --git a/c/src/lib/libbsp/arm/gba/startup/linkcmds b/c/src/lib/libbsp/arm/gba/startup/linkcmds index 174964a9d6..4c9fee2270 100644 --- a/c/src/lib/libbsp/arm/gba/startup/linkcmds +++ b/c/src/lib/libbsp/arm/gba/startup/linkcmds @@ -135,6 +135,7 @@ SECTIONS *(.rodata1) *(EXCLUDE_FILE(*.rodata.* *.ewram.o *.iwram.o) .rodata) *(.rodata.* .gnu.linkonce.r*) + KEEP (*(SORT(.rtemsroset.*))) *(.roda) /* deprecated: for compatibility with objcopyroda */ SORT(CONSTRUCTORS) . = ALIGN(4); @@ -302,6 +303,7 @@ SECTIONS *(EXCLUDE_FILE(*.rodata.* *.ewram.o *.iwram.o) .data) *(.data.* .gnu.linkonce.d.*) *(.data1) + KEEP (*(SORT(.rtemsrwset.*))) *(.sdata .sdata.* .gnu.linkonce.s.*) . = ALIGN(4); } =0xFF diff --git a/c/src/lib/libbsp/avr/avrtest/startup/linkcmds b/c/src/lib/libbsp/avr/avrtest/startup/linkcmds index 7ba15875b5..46548bffd3 100644 --- a/c/src/lib/libbsp/avr/avrtest/startup/linkcmds +++ b/c/src/lib/libbsp/avr/avrtest/startup/linkcmds @@ -172,8 +172,10 @@ SECTIONS { *(.data) *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.rodata) /* We need to include .rodata here if gcc is used */ *(.rodata*) /* with -fdata-sections. */ + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.d*) . = ALIGN(2); _edata = . ; diff --git a/c/src/lib/libbsp/bfin/TLL6527M/startup/linkcmds b/c/src/lib/libbsp/bfin/TLL6527M/startup/linkcmds index 7e37798d87..982757c6df 100644 --- a/c/src/lib/libbsp/bfin/TLL6527M/startup/linkcmds +++ b/c/src/lib/libbsp/bfin/TLL6527M/startup/linkcmds @@ -93,6 +93,7 @@ SECTIONS .data : { *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.jcr) *(.gnu.linkonce.d*) CONSTRUCTORS @@ -108,6 +109,7 @@ SECTIONS { *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > sdram diff --git a/c/src/lib/libbsp/bfin/bf537Stamp/startup/linkcmds b/c/src/lib/libbsp/bfin/bf537Stamp/startup/linkcmds index 7c1e5e4d06..795e4de611 100644 --- a/c/src/lib/libbsp/bfin/bf537Stamp/startup/linkcmds +++ b/c/src/lib/libbsp/bfin/bf537Stamp/startup/linkcmds @@ -101,6 +101,7 @@ SECTIONS .data : { *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.jcr) *(.gnu.linkonce.d*) CONSTRUCTORS @@ -116,6 +117,7 @@ SECTIONS { *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > sdram diff --git a/c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds b/c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds index a8f39fb8d5..3315f37e61 100644 --- a/c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds +++ b/c/src/lib/libbsp/bfin/eZKit533/startup/linkcmds @@ -90,6 +90,7 @@ SECTIONS .data : { *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.jcr) *(.gnu.linkonce.d*) CONSTRUCTORS @@ -105,6 +106,7 @@ SECTIONS { *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > sdram diff --git a/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds b/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds index 53ed639550..0534e05977 100644 --- a/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds +++ b/c/src/lib/libbsp/h8300/h8sim/startup/linkcmds @@ -56,6 +56,7 @@ SECTIONS . = ALIGN (16); PROVIDE(_rodata_start = . ); *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) PROVIDE(_erodata = . ); @@ -88,6 +89,7 @@ SECTIONS .data SIZEOF(.tors) + ADDR(.tors): { *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gcc_exc*) CONSTRUCTORS _edata = .; diff --git a/c/src/lib/libbsp/lm32/lm32_evr/startup/linkcmds b/c/src/lib/libbsp/lm32/lm32_evr/startup/linkcmds index e9c0009e1e..aea7cbf329 100644 --- a/c/src/lib/libbsp/lm32/lm32_evr/startup/linkcmds +++ b/c/src/lib/libbsp/lm32/lm32_evr/startup/linkcmds @@ -77,7 +77,7 @@ SECTIONS .fini : { _fini = .; KEEP(*(.fini)) } > sdram - .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } > sdram + .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > sdram .rodata1 : { *(.rodata1) } > sdram .tdata : { _TLS_Data_begin = .; @@ -154,6 +154,7 @@ SECTIONS */ PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data .data.* .gnu.linkonce.d*) + KEEP (*(SORT(.rtemsrwset.*))) SORT(CONSTRUCTORS) } > sdram .data1 : { *(.data1) } > sdram diff --git a/c/src/lib/libbsp/lm32/milkymist/startup/linkcmds b/c/src/lib/libbsp/lm32/milkymist/startup/linkcmds index d774e6662f..72466b9633 100644 --- a/c/src/lib/libbsp/lm32/milkymist/startup/linkcmds +++ b/c/src/lib/libbsp/lm32/milkymist/startup/linkcmds @@ -76,7 +76,7 @@ SECTIONS .fini : { _fini = .; KEEP(*(.fini)) } > sdram - .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } > sdram + .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > sdram .rodata1 : { *(.rodata1) } > sdram .tdata : { _TLS_Data_begin = .; @@ -153,6 +153,7 @@ SECTIONS */ PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data .data.* .gnu.linkonce.d*) + KEEP (*(SORT(.rtemsrwset.*))) SORT(CONSTRUCTORS) } > sdram .data1 : { *(.data1) } > sdram diff --git a/c/src/lib/libbsp/m32c/m32cbsp/startup/linkcmds b/c/src/lib/libbsp/m32c/m32cbsp/startup/linkcmds index f3721ad617..5f838bc31b 100644 --- a/c/src/lib/libbsp/m32c/m32cbsp/startup/linkcmds +++ b/c/src/lib/libbsp/m32c/m32cbsp/startup/linkcmds @@ -52,7 +52,7 @@ SECTIONS *(.plt) KEEP (*(.init)) KEEP (*(.fini)) - *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata .rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r.*) *(.rodata1) *(.eh_frame_hdr) KEEP (*(.eh_frame)) @@ -119,6 +119,7 @@ SECTIONS *(.dynamic) *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) KEEP (*(.gnu.linkonce.d.*personality*)) SORT(CONSTRUCTORS) *(.data1) diff --git a/c/src/lib/libbsp/m32r/m32rsim/startup/linkcmds b/c/src/lib/libbsp/m32r/m32rsim/startup/linkcmds index bca3946b95..018d405a3c 100644 --- a/c/src/lib/libbsp/m32r/m32rsim/startup/linkcmds +++ b/c/src/lib/libbsp/m32r/m32rsim/startup/linkcmds @@ -78,7 +78,7 @@ SECTIONS PROVIDE (__etext = .); PROVIDE (_etext = .); PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata : { *(.rodata .rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r.*) } .rodata1 : { *(.rodata1) } .tdata : { _TLS_Data_begin = .; @@ -168,6 +168,7 @@ SECTIONS .data : { *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) SORT(CONSTRUCTORS) } .data1 : { *(.data1) } diff --git a/c/src/lib/libbsp/m68k/av5282/startup/linkcmds b/c/src/lib/libbsp/m68k/av5282/startup/linkcmds index c72601d63f..01ba1c5098 100644 --- a/c/src/lib/libbsp/m68k/av5282/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/av5282/startup/linkcmds @@ -123,6 +123,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -157,6 +158,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsflash b/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsflash index 3d361df509..45841ff909 100644 --- a/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsflash +++ b/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsflash @@ -122,6 +122,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -157,6 +158,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsram b/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsram index 4c11cc7110..c93ba85ea8 100644 --- a/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsram +++ b/c/src/lib/libbsp/m68k/av5282/startup/linkcmdsram @@ -122,6 +122,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -156,6 +157,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/csb360/startup/linkcmds b/c/src/lib/libbsp/m68k/csb360/startup/linkcmds index 9b1c2d5e77..e06ccc3068 100644 --- a/c/src/lib/libbsp/m68k/csb360/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/csb360/startup/linkcmds @@ -95,6 +95,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -128,6 +129,7 @@ SECTIONS *(.shdata) . = ALIGN (0x10); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) . = ALIGN (0x10); *(.gcc_exc) *(.gcc_except_table*) diff --git a/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds b/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds index d831f7a7fa..34f42b9dbf 100644 --- a/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/gen68302/startup/linkcmds @@ -109,6 +109,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -137,6 +138,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/gen68340/startup/linkcmds b/c/src/lib/libbsp/m68k/gen68340/startup/linkcmds index bde2809811..5f95ed32c1 100644 --- a/c/src/lib/libbsp/m68k/gen68340/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/gen68340/startup/linkcmds @@ -137,6 +137,7 @@ SECTIONS { . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -165,6 +166,7 @@ SECTIONS { .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds index 7957b043be..fbdf14be6a 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds @@ -101,6 +101,7 @@ SECTIONS { . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -129,6 +130,7 @@ SECTIONS { .data : { _copy_start = .; *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp index d14ed8faac..ccd08a14a2 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp +++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.bootp @@ -106,6 +106,7 @@ SECTIONS { . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -134,6 +135,7 @@ SECTIONS { .data : AT(SIZEOF(.text)) { _copy_start = .; *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.jcr) *(.gcc_except_table*) diff --git a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom index 22637bf1d9..777700e6a1 100644 --- a/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom +++ b/c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom @@ -105,6 +105,7 @@ SECTIONS { . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -133,6 +134,7 @@ SECTIONS { .data : AT(SIZEOF(.text)) { _copy_start = .; *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.jcr) *(.gcc_except_table*) diff --git a/c/src/lib/libbsp/m68k/idp/startup/linkcmds b/c/src/lib/libbsp/m68k/idp/startup/linkcmds index a8efe63648..8f4b037a78 100644 --- a/c/src/lib/libbsp/m68k/idp/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/idp/startup/linkcmds @@ -106,6 +106,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -134,6 +135,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds b/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds index d7ceb201b1..22b526885a 100644 --- a/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds @@ -130,6 +130,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -161,6 +162,7 @@ SECTIONS *(.shdata) . = ALIGN (0x10); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) . = ALIGN (0x10); *(.gcc_exc) *(.gcc_except_table*) diff --git a/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds.flash b/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds.flash index 12db0e2902..57c1dafa3f 100644 --- a/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds.flash +++ b/c/src/lib/libbsp/m68k/mcf5206elite/startup/linkcmds.flash @@ -130,6 +130,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -162,6 +163,7 @@ SECTIONS *(.shdata) . = ALIGN (0x10); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) . = ALIGN (0x10); *(.gcc_exc) *(.gcc_except_table*) diff --git a/c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds b/c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds index e10a57fad2..8b0981ba73 100644 --- a/c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mcf52235/startup/linkcmds @@ -110,6 +110,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -146,6 +147,7 @@ SECTIONS PROVIDE( _copy_start = .); *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5225x/startup/linkcmds b/c/src/lib/libbsp/m68k/mcf5225x/startup/linkcmds index b0a48b70a3..42f085706d 100644 --- a/c/src/lib/libbsp/m68k/mcf5225x/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mcf5225x/startup/linkcmds @@ -110,6 +110,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -145,6 +146,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds index 1fa3bef1c7..0aa079a938 100644 --- a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds @@ -130,6 +130,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -164,6 +165,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash index 8082860fd6..6a724a9067 100644 --- a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash +++ b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash @@ -134,6 +134,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -169,6 +170,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram index d96036494b..06a62e1765 100644 --- a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram +++ b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram @@ -130,6 +130,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -164,6 +165,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmds b/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmds index b5a228e161..3426f213ef 100644 --- a/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmds @@ -121,6 +121,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -156,6 +157,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmdsflash b/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmdsflash index 30f46877f3..c1e081dbab 100644 --- a/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmdsflash +++ b/c/src/lib/libbsp/m68k/mcf5329/startup/linkcmdsflash @@ -117,6 +117,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -152,6 +153,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds index aeed9a3844..3640c514a4 100644 --- a/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mrm332/startup/linkcmds @@ -137,6 +137,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -169,6 +170,7 @@ SECTIONS { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds index ad4cba6cb5..85d614d943 100644 --- a/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mvme136/startup/linkcmds @@ -106,6 +106,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -134,6 +135,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme147/startup/linkcmds index bc75072daf..fcbd073a71 100644 --- a/c/src/lib/libbsp/m68k/mvme147/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mvme147/startup/linkcmds @@ -110,6 +110,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -138,6 +139,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mvme147s/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme147s/startup/linkcmds index e8ac4c5c70..fbc85271a2 100644 --- a/c/src/lib/libbsp/m68k/mvme147s/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mvme147s/startup/linkcmds @@ -110,6 +110,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -138,6 +139,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds index 10a5c1deb4..1368d05831 100644 --- a/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mvme162/startup/linkcmds @@ -113,6 +113,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -141,6 +142,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/mvme167/startup/linkcmds b/c/src/lib/libbsp/m68k/mvme167/startup/linkcmds index d585bf9e36..b10b29d13b 100644 --- a/c/src/lib/libbsp/m68k/mvme167/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/mvme167/startup/linkcmds @@ -119,6 +119,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) PROVIDE(_erodata = . ); @@ -148,6 +149,7 @@ SECTIONS .data : { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/debugger b/c/src/lib/libbsp/m68k/ods68302/startup/debugger index 8d156bd3c8..62fd5bc07d 100644 --- a/c/src/lib/libbsp/m68k/ods68302/startup/debugger +++ b/c/src/lib/libbsp/m68k/ods68302/startup/debugger @@ -50,6 +50,8 @@ SECTIONS { data_start = .; *(.data) + KEEP (*(SORT(.rtemsroset.*))) + KEEP (*(SORT(.rtemsrwset.*))) edata = .; } .bss (ADDR(.data) + SIZEOF(.data)) : diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds b/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds index c153825d39..39bdee0cbc 100644 --- a/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/ods68302/startup/linkcmds @@ -122,6 +122,7 @@ SECTIONS . = ALIGN (16); _rodata_start = .; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -152,6 +153,7 @@ SECTIONS AT (ADDR(.tdata) + SIZEOF(.tdata)) { PROVIDE (_copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/rom b/c/src/lib/libbsp/m68k/ods68302/startup/rom index 352ae6a89a..4b0e81050f 100644 --- a/c/src/lib/libbsp/m68k/ods68302/startup/rom +++ b/c/src/lib/libbsp/m68k/ods68302/startup/rom @@ -52,6 +52,8 @@ SECTIONS { data_start = .; *(.data) + KEEP (*(SORT(.rtemsroset.*))) + KEEP (*(SORT(.rtemsrwset.*))) edata = .; } .bss (ADDR(.data) + SIZEOF(.data)) : diff --git a/c/src/lib/libbsp/m68k/uC5282/startup/linkcmds b/c/src/lib/libbsp/m68k/uC5282/startup/linkcmds index dbf90815ea..56905fc0ec 100644 --- a/c/src/lib/libbsp/m68k/uC5282/startup/linkcmds +++ b/c/src/lib/libbsp/m68k/uC5282/startup/linkcmds @@ -138,6 +138,7 @@ SECTIONS . = ALIGN (16); _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN (16); @@ -172,6 +173,7 @@ SECTIONS PROVIDE( _data_dest_start = . ); PROVIDE( _copy_start = .); *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) *(.gcc_except_table*) *(.jcr) diff --git a/c/src/lib/libbsp/mips/csb350/startup/linkcmds b/c/src/lib/libbsp/mips/csb350/startup/linkcmds index 47234fe8c9..384cd5b49d 100644 --- a/c/src/lib/libbsp/mips/csb350/startup/linkcmds +++ b/c/src/lib/libbsp/mips/csb350/startup/linkcmds @@ -111,6 +111,7 @@ SECTIONS *(.rdata) *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } >ram @@ -139,6 +140,7 @@ SECTIONS *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) } >ram diff --git a/c/src/lib/libbsp/mips/genmongoosev/startup/linkcmds b/c/src/lib/libbsp/mips/genmongoosev/startup/linkcmds index c0da8b774f..e396379a1f 100644 --- a/c/src/lib/libbsp/mips/genmongoosev/startup/linkcmds +++ b/c/src/lib/libbsp/mips/genmongoosev/startup/linkcmds @@ -108,6 +108,7 @@ SECTIONS *(.rdata) *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } >ram @@ -136,6 +137,7 @@ SECTIONS *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) } >ram diff --git a/c/src/lib/libbsp/mips/hurricane/startup/linkcmds b/c/src/lib/libbsp/mips/hurricane/startup/linkcmds index f2612488cc..2706d8103f 100644 --- a/c/src/lib/libbsp/mips/hurricane/startup/linkcmds +++ b/c/src/lib/libbsp/mips/hurricane/startup/linkcmds @@ -97,6 +97,7 @@ SECTIONS *(.rdata) *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } @@ -124,6 +125,7 @@ SECTIONS .data : { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) } diff --git a/c/src/lib/libbsp/mips/rbtx4925/startup/linkcmds b/c/src/lib/libbsp/mips/rbtx4925/startup/linkcmds index 3c08ce4075..d7039ab354 100644 --- a/c/src/lib/libbsp/mips/rbtx4925/startup/linkcmds +++ b/c/src/lib/libbsp/mips/rbtx4925/startup/linkcmds @@ -97,6 +97,7 @@ SECTIONS *(.rdata) *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } @@ -124,6 +125,7 @@ SECTIONS .data : { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) } diff --git a/c/src/lib/libbsp/mips/rbtx4938/startup/linkcmds b/c/src/lib/libbsp/mips/rbtx4938/startup/linkcmds index af99da5220..a0f4c412ae 100644 --- a/c/src/lib/libbsp/mips/rbtx4938/startup/linkcmds +++ b/c/src/lib/libbsp/mips/rbtx4938/startup/linkcmds @@ -97,6 +97,7 @@ SECTIONS *(.rdata) *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } @@ -124,6 +125,7 @@ SECTIONS .data : { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) } diff --git a/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds b/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds index 15be77d76a..e1e489c1fc 100644 --- a/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds +++ b/c/src/lib/libbsp/moxie/moxiesim/startup/linkcmds @@ -130,7 +130,7 @@ SECTIONS { KEEP (*(.fini)) } =0 - .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata : { *(.rodata) *(.rodata.*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } .rodata1 : { *(.rodata1) } .tdata : { _TLS_Data_begin = .; @@ -156,6 +156,7 @@ SECTIONS { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) } diff --git a/c/src/lib/libbsp/nios2/nios2_iss/startup/linkcmds b/c/src/lib/libbsp/nios2/nios2_iss/startup/linkcmds index 74e5485395..662d097619 100644 --- a/c/src/lib/libbsp/nios2/nios2_iss/startup/linkcmds +++ b/c/src/lib/libbsp/nios2/nios2_iss/startup/linkcmds @@ -193,7 +193,7 @@ SECTIONS { PROVIDE (__ram_rodata_start = ABSOLUTE(.)); . = ALIGN(32 / 8); - *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata .rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r.*) *(.rodata1) } > onchip_memory_0 @@ -227,6 +227,7 @@ SECTIONS *(.got.plt) *(.got) *(.data1) *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) _gp = ABSOLUTE(. + 0x8000); PROVIDE(gp = _gp); diff --git a/c/src/lib/libbsp/powerpc/beatnik/startup/linkcmds b/c/src/lib/libbsp/powerpc/beatnik/startup/linkcmds index ae3fe06700..84cbc97fdf 100644 --- a/c/src/lib/libbsp/powerpc/beatnik/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/beatnik/startup/linkcmds @@ -93,7 +93,7 @@ SECTIONS } > CODE .fini : { _fini = .; *(.fini) } >CODE - .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } > CODE + .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > CODE .rodata1 : { *(.rodata1) } > CODE .tdata : { _TLS_Data_begin = .; @@ -142,6 +142,7 @@ SECTIONS { PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) CONSTRUCTORS } > CODE diff --git a/c/src/lib/libbsp/powerpc/ep1a/startup/linkcmds b/c/src/lib/libbsp/powerpc/ep1a/startup/linkcmds index 775374cf72..69644e37d8 100644 --- a/c/src/lib/libbsp/powerpc/ep1a/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/ep1a/startup/linkcmds @@ -62,7 +62,7 @@ SECTIONS } =0 .init : { _init = .; *(.init) } .fini : { _fini = .; *(.fini) } - .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } + .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } .rodata1 : { *(.rodata1) } .tdata : { _TLS_Data_begin = .; @@ -109,6 +109,7 @@ SECTIONS { PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d.*) CONSTRUCTORS } diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/gen5200/startup/linkcmds.base index 4c186efae6..4ded9082d4 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/startup/linkcmds.base +++ b/c/src/lib/libbsp/powerpc/gen5200/startup/linkcmds.base @@ -87,6 +87,7 @@ SECTIONS { * BSP: Moved into .text from .* */ *(.rodata .rodata.* .gnu.linkonce.r.*) + KEEP (*(SORT(.rtemsroset.*))) *(.rodata1) *(.interp) *(.note.gnu.build-id) @@ -223,6 +224,7 @@ SECTIONS { PROVIDE_HIDDEN (__fini_array_end = .); *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) KEEP (*(.gnu.linkonce.d.*personality*)) SORT(CONSTRUCTORS) diff --git a/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds b/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds index fc8f68e8ed..bed8580827 100644 --- a/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/haleakala/startup/linkcmds @@ -37,6 +37,7 @@ SECTIONS *(.text*) *(.rodata*) *(.rodata1) + KEEP (*(SORT(.rtemsroset.*))) /* * Special FreeBSD sysctl sections. @@ -208,6 +209,7 @@ SECTIONS data.start = .; *(.data) *(.data1) + KEEP (*(SORT(.rtemsrwset.*))) *(.data.* .gnu.linkonce.d.*) data.end = .; } > RAM diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds b/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds index 45332bceaa..537e4db664 100644 --- a/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/mbx8xx/startup/linkcmds @@ -125,6 +125,7 @@ SECTIONS *(.shdata) *(.rodata*) *(.rodata1) + KEEP (*(SORT(.rtemsroset.*))) *(.descriptors) *(rom_ver) _erodata = .; @@ -207,6 +208,7 @@ SECTIONS *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.data1) PROVIDE (__EXCEPT_START__ = .); diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds index fc14155805..de52e4664a 100644 --- a/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/mpc8260ads/startup/linkcmds @@ -125,6 +125,7 @@ SECTIONS *(.shdata) *(.rodata) *(.rodata1) + KEEP (*(SORT(.rtemsroset.*))) *(.descriptors) *(rom_ver) _erodata = .; @@ -269,6 +270,7 @@ SECTIONS *(.data) *(.data1) *(.data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) PROVIDE (__SDATA_START__ = .); *(.sdata .sdata.* .gnu.linkonce.s.*) data.end = .; diff --git a/c/src/lib/libbsp/powerpc/qemuppc/startup/linkcmds b/c/src/lib/libbsp/powerpc/qemuppc/startup/linkcmds index 4af6976cb1..6e1e877f09 100644 --- a/c/src/lib/libbsp/powerpc/qemuppc/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/qemuppc/startup/linkcmds @@ -95,7 +95,7 @@ SECTIONS .rodata : { - *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata .rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r.*) *(.rodata1) . = ALIGN (bsp_section_align); __rodata_end = .; @@ -127,6 +127,7 @@ SECTIONS { __data_start = .; *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) KEEP (*(.gnu.linkonce.d.*personality*)) SORT(CONSTRUCTORS) *(.data1) diff --git a/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds b/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds index 46b5e381de..70065572fc 100644 --- a/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/score603e/startup/linkcmds @@ -101,7 +101,7 @@ SECTIONS } >RAM .init : { _init = .; __init = .; *(.init) } >RAM .fini : { _fini = .; __fini = .; *(.fini) } >RAM - .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } >RAM + .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } >RAM .rodata1 : { *(.rodata1) } >RAM .tdata : { _TLS_Data_begin = .; @@ -146,6 +146,7 @@ SECTIONS { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d.*) CONSTRUCTORS } >RAM diff --git a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds index 34969e1cf6..d0d22a774e 100644 --- a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds @@ -77,7 +77,7 @@ SECTIONS .fini : { _fini = .; KEEP(*(.fini)) } > CODE - .rodata : { *(.rodata*) *(.gnu.linkonce.r*) } > CODE + .rodata : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > CODE .rodata1 : { *(.rodata1) } > CODE .tdata : { @@ -157,6 +157,7 @@ SECTIONS */ PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data .data.* .gnu.linkonce.d*) + KEEP (*(SORT(.rtemsrwset.*))) SORT(CONSTRUCTORS) } > CODE .data1 : { *(.data1) } > CODE diff --git a/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds b/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds index 809b9a33bb..ebc9e816a4 100644 --- a/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/ss555/startup/linkcmds @@ -121,6 +121,7 @@ SECTIONS *(.shdata) *(.rodata*) *(.rodata1) + KEEP (*(SORT(.rtemsroset.*))) *(.descriptors) *(rom_ver) _erodata = .; @@ -171,6 +172,7 @@ SECTIONS *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.data1) PROVIDE (__SDATA_START__ = .); diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/tqm8xx/startup/linkcmds.base index 979989fe07..fd1ba71d52 100644 --- a/c/src/lib/libbsp/powerpc/tqm8xx/startup/linkcmds.base +++ b/c/src/lib/libbsp/powerpc/tqm8xx/startup/linkcmds.base @@ -78,7 +78,7 @@ SECTIONS { /* * BSP: Moved into .text from .* */ - *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.rodata .rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r.*) *(.rodata1) *(.interp) *(.note.gnu.build-id) @@ -218,6 +218,7 @@ SECTIONS { PROVIDE_HIDDEN (__fini_array_end = .); *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(SORT(.rtemsrwset.*))) KEEP (*(.gnu.linkonce.d.*personality*)) SORT(CONSTRUCTORS) diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/linkcmds b/c/src/lib/libbsp/powerpc/virtex4/startup/linkcmds index 55b8f887cd..a22ee3f7c9 100644 --- a/c/src/lib/libbsp/powerpc/virtex4/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/virtex4/startup/linkcmds @@ -91,7 +91,7 @@ SECTIONS } > RAM /* Miscellaneous read-only data */ - .rodata : { *(.rodata.* .gnu.linkonce.r*) } > RAM + .rodata : { *(.rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r*) } > RAM .rodata1 : { *(.rodata1) } > RAM .tdata : { @@ -139,6 +139,7 @@ SECTIONS .data : { PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) } > RAM diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/linkcmds b/c/src/lib/libbsp/powerpc/virtex5/startup/linkcmds index 63d187cacb..ce88a43035 100644 --- a/c/src/lib/libbsp/powerpc/virtex5/startup/linkcmds +++ b/c/src/lib/libbsp/powerpc/virtex5/startup/linkcmds @@ -91,7 +91,7 @@ SECTIONS } > RAM /* Miscellaneous read-only data */ - .rodata : { *(.rodata.* .gnu.linkonce.r*) } > RAM + .rodata : { *(.rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r*) } > RAM .rodata1 : { *(.rodata1) } > RAM .tdata : { @@ -139,6 +139,7 @@ SECTIONS .data : { PROVIDE(__DATA_START__ = ABSOLUTE(.) ); *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) } > RAM diff --git a/c/src/lib/libbsp/sh/gensh1/startup/linkcmds b/c/src/lib/libbsp/sh/gensh1/startup/linkcmds index 80a241c896..d5945b37de 100644 --- a/c/src/lib/libbsp/sh/gensh1/startup/linkcmds +++ b/c/src/lib/libbsp/sh/gensh1/startup/linkcmds @@ -131,7 +131,7 @@ SECTIONS .fini . : { KEEP(*(.fini)) } > ram =0 .ctors . : { KEEP(*(.ctors)) } > ram =0 .dtors . : { KEEP(*(.dtors)) } > ram =0 - .rodata . : { *(.rodata*) *(.gnu.linkonce.r*) } > ram + .rodata . : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > ram .rodata1 . : { *(.rodata1) } > ram .tdata : { __TLS_Data_begin = .; @@ -155,6 +155,7 @@ SECTIONS .data . : { *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gcc_exc*) ___EH_FRAME_BEGIN__ = .; *(.eh_fram*) diff --git a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds index e9f73f9397..d58f25e48f 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds @@ -142,7 +142,7 @@ SECTIONS .fini . : { KEEP(*(.fini)) } > ram =0 .ctors . : { KEEP(*(.ctors)) } > ram =0 .dtors . : { KEEP(*(.dtors)) } > ram =0 - .rodata . : { *(.rodata*) *(.gnu.linkonce.r*) } > ram + .rodata . : { *(.rodata*) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > ram .rodata1 . : { *(.rodata1) } > ram .tdata : { __TLS_Data_begin = .; @@ -166,6 +166,7 @@ SECTIONS .data . : { *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gcc_exc*) ___EH_FRAME_BEGIN__ = .; *(.eh_fram*) diff --git a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram index c962e8f9a0..d7449077da 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram @@ -139,7 +139,7 @@ SECTIONS _etext = .; PROVIDE (etext = .); .fini . : { *(.fini) } > ram =0 - .rodata . : { *(.rodata) *(.gnu.linkonce.r*) } > ram + .rodata . : { *(.rodata) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > ram .rodata1 . : { *(.rodata1) } > ram .tdata : { __TLS_Data_begin = .; @@ -163,6 +163,7 @@ SECTIONS .data . : { *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) CONSTRUCTORS } > ram diff --git a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom index 321760aa6f..c59613b3f2 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom @@ -140,7 +140,7 @@ SECTIONS _etext = .; PROVIDE (etext = .); .fini . : { *(.fini) } > ram =0 - .rodata . : { *(.rodata) *(.gnu.linkonce.r*) } > ram + .rodata . : { *(.rodata) KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > ram .rodata1 . : { *(.rodata1) } > ram .tdata : { __TLS_Data_begin = .; @@ -164,6 +164,7 @@ SECTIONS .data . : { *(.data) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) CONSTRUCTORS } > ram diff --git a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds index 7ddb95d9db..40b764e9ff 100644 --- a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds +++ b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds @@ -87,6 +87,7 @@ SECTIONS { *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > ram .tdata : { @@ -113,6 +114,7 @@ SECTIONS { copy_start = .; *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gcc_exc*) ___EH_FRAME_BEGIN__ = .; *(.eh_fram*) diff --git a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom index a84b502717..ee61498ad3 100644 --- a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom +++ b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom @@ -102,6 +102,7 @@ SECTIONS { *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN(32); } > rom @@ -162,6 +163,7 @@ SECTIONS copy_start = .; *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) copy_end = .; diff --git a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom2ram b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom2ram index 30c315e0d4..65656247be 100644 --- a/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom2ram +++ b/c/src/lib/libbsp/sh/gensh4/startup/linkcmds.rom2ram @@ -89,6 +89,7 @@ SECTIONS { *(.rodata) *(.rodata.*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) . = ALIGN(32); } > ram @@ -147,6 +148,7 @@ SECTIONS { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) SORT(CONSTRUCTORS) copy_end = .; diff --git a/c/src/lib/libbsp/sh/shsim/startup/linkcmds.sim b/c/src/lib/libbsp/sh/shsim/startup/linkcmds.sim index 5b0d4d7ff7..c9f9ad567a 100644 --- a/c/src/lib/libbsp/sh/shsim/startup/linkcmds.sim +++ b/c/src/lib/libbsp/sh/shsim/startup/linkcmds.sim @@ -121,7 +121,7 @@ SECTIONS } =0 _etext = .; PROVIDE (etext = .); - .rodata . : { *(.rodata*) .rodata.* *(.gnu.linkonce.r*) } > ram + .rodata . : { *(.rodata*) .rodata.* KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) } > ram .rodata1 . : { *(.rodata1) } > ram .tdata : { __TLS_Data_begin = .; @@ -145,6 +145,7 @@ SECTIONS .data . : { *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gcc_exc*) ___EH_FRAME_BEGIN__ = .; *(.eh_fram*) diff --git a/c/src/lib/libbsp/sparc64/shared/startup/linkcmds b/c/src/lib/libbsp/sparc64/shared/startup/linkcmds index 95c8913f3b..24e0a0147d 100644 --- a/c/src/lib/libbsp/sparc64/shared/startup/linkcmds +++ b/c/src/lib/libbsp/sparc64/shared/startup/linkcmds @@ -138,6 +138,7 @@ SECTIONS _rodata_start = . ; *(.rodata*) + KEEP (*(SORT(.rtemsroset.*))) *(.gnu.linkonce.r*) _erodata = ALIGN( 0x10 ) ; @@ -173,6 +174,7 @@ SECTIONS _data_start = . ; *(.data) *(.data*) + KEEP (*(SORT(.rtemsrwset.*))) *(.rodata) /* We need to include .rodata here if gcc is used */ *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) diff --git a/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds b/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds index fe0f22b942..ff7bb85211 100644 --- a/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds +++ b/c/src/lib/libbsp/v850/gdbv850sim/startup/linkcmds @@ -89,7 +89,7 @@ SECTIONS *(.call_table_text) } .fini : { KEEP (*(.fini)) } =0 - .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } + .rodata : { *(.rodata .rodata.* KEEP (*(SORT(.rtemsroset.*))) .gnu.linkonce.r.*) } .rodata1 : { *(.rodata1) } .tdata : { __TLS_Data_begin = .; @@ -111,6 +111,7 @@ SECTIONS { *(.data) *(.data.*) + KEEP (*(SORT(.rtemsrwset.*))) *(.gnu.linkonce.d*) CONSTRUCTORS } diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index fb93b98096..c90f4a2404 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -17,6 +17,7 @@ include_sys_HEADERS += include/sys/timex.h include_rtemsdir = $(includedir)/rtems include_rtems_HEADERS = +include_rtems_HEADERS += include/rtems/linkersets.h include_rtems_HEADERS += include/rtems/system.h include_rtems_HEADERS += include/rtems/seterr.h diff --git a/cpukit/score/include/rtems/linkersets.h b/cpukit/score/include/rtems/linkersets.h new file mode 100644 index 0000000000..e40be6679d --- /dev/null +++ b/cpukit/score/include/rtems/linkersets.h @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifndef _RTEMS_LINKERSET_H +#define _RTEMS_LINKERSET_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define RTEMS_LINKER_SET_BEGIN( set ) \ + _Linker_set_##set##_begin + +#define RTEMS_LINKER_SET_END( set ) \ + _Linker_set_##set##_end + +#define RTEMS_LINKER_SET_SIZE( set ) \ + ( (size_t) ( _Linker_set_##set##_end - _Linker_set_##set##_begin ) ) + +#define RTEMS_LINKER_ROSET_DECLARE( set, type ) \ + extern type volatile const RTEMS_LINKER_SET_BEGIN( set )[0]; \ + extern type volatile const RTEMS_LINKER_SET_END( set )[0] + +#define RTEMS_LINKER_ROSET( set, type ) \ + type volatile const RTEMS_LINKER_SET_BEGIN( set )[0] \ + RTEMS_SECTION( ".rtemsroset." #set ".begin" ) RTEMS_USED; \ + type volatile const RTEMS_LINKER_SET_END( set )[0] \ + RTEMS_SECTION( ".rtemsroset." #set ".end" ) RTEMS_USED + +#define RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ) \ + extern type volatile const _Linker_set_##set##_##item + +#define RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ) \ + static type volatile const * const _Set_reference_##set##_##item \ + RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \ + &_Linker_set_##set##_##item + +#define RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ) \ + type volatile const _Linker_set_##set##_##item \ + RTEMS_SECTION( ".rtemsroset." #set ".content.0." RTEMS_XSTRING( order ) ) \ + RTEMS_USED + +#define RTEMS_LINKER_ROSET_ITEM( set, type, item ) \ + type volatile const _Linker_set_##set##_##item \ + RTEMS_SECTION( ".rtemsroset." #set ".content.1" ) RTEMS_USED + +#define RTEMS_LINKER_RWSET_DECLARE( set, type ) \ + extern type volatile RTEMS_LINKER_SET_BEGIN( set )[0]; \ + extern type volatile RTEMS_LINKER_SET_END( set )[0] + +#define RTEMS_LINKER_RWSET( set, type ) \ + type volatile RTEMS_LINKER_SET_BEGIN( set )[0] \ + RTEMS_SECTION( ".rtemsrwset." #set ".begin" ) RTEMS_USED; \ + type volatile RTEMS_LINKER_SET_END( set )[0] \ + RTEMS_SECTION( ".rtemsrwset." #set ".end" ) RTEMS_USED + +#define RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ) \ + extern type volatile _Linker_set_##set##_##item + +/* + * The .rtemsroset is here not a typo. We must ensure that the references are + * not a victim of the garbage collection of the linker. Thus, we place them + * in a dedicated area of the RTEMS read-only linker set section. + */ +#define RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ) \ + static type volatile * const _Set_reference_##set##_##item \ + RTEMS_SECTION( ".rtemsroset.reference" ) RTEMS_USED = \ + &_Linker_set_##set##_##item + +#define RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ) \ + type volatile _Linker_set_##set##_##item \ + RTEMS_SECTION( ".rtemsrwset." #set ".content.0." RTEMS_XSTRING( order ) ) \ + RTEMS_USED + +#define RTEMS_LINKER_RWSET_ITEM( set, type, item ) \ + type volatile _Linker_set_##set##_##item \ + RTEMS_SECTION( ".rtemsrwset." #set ".content.1" ) RTEMS_USED + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _RTEMS_LINKERSET_H */ diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am index 4b96109774..4a45e8787a 100644 --- a/cpukit/score/preinstall.am +++ b/cpukit/score/preinstall.am @@ -43,6 +43,10 @@ $(PROJECT_INCLUDE)/rtems/$(dirstamp): @: > $(PROJECT_INCLUDE)/rtems/$(dirstamp) PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/$(dirstamp) +$(PROJECT_INCLUDE)/rtems/linkersets.h: include/rtems/linkersets.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/linkersets.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/linkersets.h + $(PROJECT_INCLUDE)/rtems/system.h: include/rtems/system.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/system.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/system.h diff --git a/doc/user/Makefile.am b/doc/user/Makefile.am index f17179e416..ef9fdfd5eb 100644 --- a/doc/user/Makefile.am +++ b/doc/user/Makefile.am @@ -15,7 +15,7 @@ GENERATED_FILES = overview.texi concepts.texi datatypes.texi init.texi \ signal.texi part.texi region.texi dpmem.texi io.texi fatal.texi \ schedule.texi rtmon.texi barrier.texi bsp.texi userext.texi conf.texi \ mp.texi stackchk.texi cpuuse.texi object.texi chains.texi rbtree.texi \ - timespec.texi cbs.texi dirstat.texi smp.texi libpci.texi + timespec.texi cbs.texi dirstat.texi smp.texi libpci.texi linkersets.texi COMMON_FILES += $(top_srcdir)/common/cpright.texi @@ -210,6 +210,11 @@ cbs.texi: cbs.t dirstat.texi: dirstat.t $(BMENU2) -p "Constant Bandwidth Server Scheduler API CBS_GET_APPROVED_BUDGET - Get scheduler approved execution time" \ + -u "Top" \ + -n "Linker Sets" < $< > $@ + +linkersets.texi: linkersets.t + $(BMENU2) -p "Directive Status Codes STATUS_TEXT - Returns the enumeration name for a status code" \ -u "Top" \ -n "Example Application" < $< > $@ @@ -217,6 +222,6 @@ EXTRA_DIST = bsp.t cbs.t clock.t chains.t concepts.t cpuuse.t datatypes.t conf.t dpmem.t event.t fatal.t init.t intr.t io.t mp.t msg.t overview.t \ part.t rbtree.t region.t rtmon.t sem.t schedule.t signal.t stackchk.t \ task.t timer.t userext.t dirstat.t $(TXT_FILES) $(PNG_FILES) $(EPS_IMAGES) \ - $(noinst_DATA) + $(noinst_DATA) linkersets.t CLEANFILES += c_user.info c_user.info-? c_user.info-?? diff --git a/doc/user/c_user.texi b/doc/user/c_user.texi index ebbdec9482..cc6935865a 100644 --- a/doc/user/c_user.texi +++ b/doc/user/c_user.texi @@ -116,6 +116,7 @@ * Timespec Helpers:: * Constant Bandwidth Server Scheduler API:: * Directive Status Codes:: +* Linker Sets:: * Example Application:: * Glossary:: * Command and Variable Index:: @@ -162,6 +163,7 @@ @include timespec.texi @include cbs.texi @include dirstat.texi +@include linkersets.texi @include example.texi @include glossary.texi diff --git a/doc/user/example.texi b/doc/user/example.texi index 157247e8d2..d6f24b9b14 100644 --- a/doc/user/example.texi +++ b/doc/user/example.texi @@ -3,7 +3,7 @@ @c On-Line Applications Research Corporation (OAR). @c All rights reserved. -@node Example Application, Glossary, Directive Status Codes STATUS_TEXT - Returns the enumeration name for a status code, Top +@node Example Application, Glossary, Linker Sets RTEMS_LINKER_RWSET_ITEM_ORDERED - Defines an ordered read-write linker set item, Top @chapter Example Application @example diff --git a/doc/user/linkersets.t b/doc/user/linkersets.t new file mode 100644 index 0000000000..9d1abda513 --- /dev/null +++ b/doc/user/linkersets.t @@ -0,0 +1,421 @@ +@c +@c Copyright 2015 embedded brains GmbH +@c All rights reserved. + +@chapter Linker Sets + +@cindex linkersets + +@section Introduction + +Linker sets are a flexible means to create arrays of items out of a set of +object files at link-time. For example its possible to define an item @emph{I} +of type @emph{T} in object file @emph{A} and an item @emph{J} of type @emph{T} +in object file @emph{B} to be a member of a linker set @emph{S}. The linker +will then collect these two items @emph{I} and @emph{J} and place them in +consecutive memory locations, so that they can be accessed like a normal array +defined in one object file. The size of a linker set is defined by its begin +and end markers. A linker set may be empty. It should only contain items of +the same type. + +The following macros are provided to create, populate and use linker sets. + +@itemize @bullet +@item @code{RTEMS_LINKER_SET_BEGIN} - Designator of the linker set begin marker +@item @code{RTEMS_LINKER_SET_END} - Designator of the linker set end marker +@item @code{RTEMS_LINKER_SET_SIZE} - The linker set size in characters +@item @code{RTEMS_LINKER_ROSET_DECLARE} - Declares a read-only linker set +@item @code{RTEMS_LINKER_ROSET} - Defines a read-only linker set +@item @code{RTEMS_LINKER_ROSET_ITEM_DECLARE} - Declares a read-only linker set item +@item @code{RTEMS_LINKER_ROSET_ITEM_REFERENCE} - References a read-only linker set item +@item @code{RTEMS_LINKER_ROSET_ITEM} - Defines a read-only linker set item +@item @code{RTEMS_LINKER_ROSET_ITEM_ORDERED} - Defines an ordered read-only linker set item +@item @code{RTEMS_LINKER_RWSET_DECLARE} - Declares a read-write linker set +@item @code{RTEMS_LINKER_RWSET} - Defines a read-write linker set +@item @code{RTEMS_LINKER_RWSET_ITEM_DECLARE} - Declares a read-write linker set item +@item @code{RTEMS_LINKER_RWSET_ITEM_REFERENCE} - References a read-write linker set item +@item @code{RTEMS_LINKER_RWSET_ITEM} - Defines a read-write linker set item +@item @code{RTEMS_LINKER_RWSET_ITEM_ORDERED} - Defines an ordered read-write linker set item +@end itemize + +@section Background + +Linker sets are used not only in RTEMS, but also for example in Linux, in +FreeBSD, for the GNU C constructor extension and for global C++ constructors. +They provide a space efficient and flexible means to initialize modules. A +linker set consists of +@itemize @bullet +@item dedicated input sections for the linker (e.g. @code{.ctors} and +@code{.ctors.*} in the case of global constructors), +@item a begin marker (e.g. provided by @code{crtbegin.o}, and +@item an end marker (e.g. provided by @code{ctrend.o}). +@end itemize +A module may place a certain data item into the dedicated input section. The +linker will collect all such data items in this section and creates a begin and +end marker. The initialization code can then use the begin and end markers to +find all the collected data items (e.g. pointers to initialization functions). + +In the linker command file of the GNU linker we need the following output +section descriptions. +@example +@group +/* To be placed in a read-only memory region */ +.rtemsroset : @{ + KEEP (*(SORT(.rtemsroset.*))) +@} + +/* To be placed in a read-write memory region */ +.rtemsrwset : @{ + KEEP (*(SORT(.rtemsrwset.*))) +@} +@end group +@end example +The @code{KEEP()} ensures that a garbage collection by the linker will not +discard the content of this section. This would normally be the case since the +linker set items are not referenced directly. The @code{SORT()} directive +sorts the input sections lexicographically. Please note the lexicographical +order of the @code{.begin}, @code{.content} and @code{.end} section name parts +in the RTEMS linker sets macros which ensures that the position of the begin +and end markers are right. + +So, what is the benefit of using linker sets to initialize modules? It can be +used to initialize and include only those RTEMS managers and other components +which are used by the application. For example, in case an application uses +message queues, it must call @code{rtems_message_queue_create()}. In the +module implementing this function, we can place a linker set item and register +the message queue handler constructor. Otherwise, in case the application does +not use message queues, there will be no reference to the +@code{rtems_message_queue_create()} function and the constructor is not +registered, thus nothing of the message queue handler will be in the final +executable. + +For an example see test program @file{sptests/splinkersets01}. + +@section Directives + +@macro linkersetsset +The @code{set} parameter itself must be a valid C designator on which no macro +expansion is performed. It uniquely identifies the linker set. +@end macro + +@macro linkersetstype +The @code{type} parameter defines the type of the linker set items. The type +must be the same for all macro invocations of a particular linker set. +@end macro + +@macro linkersetsitem +The @code{item} parameter itself must be a valid C designator on which no macro +expansion is performed. It uniquely identifies an item in the linker set. +@end macro + +@macro linkersetsorder +The @code{order} parameter must be a valid linker input section name part on +which macro expansion is performed. The items are lexicographically ordered +according to the @code{order} parameter within a linker set. Ordered items are +placed before unordered items in the linker set. +@end macro + +@page + +@subsection RTEMS_LINKER_SET_BEGIN - Designator of the linker set begin marker + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_SET_BEGIN +@example +volatile type *begin = RTEMS_LINKER_SET_BEGIN( set ); +@end example + +@subheading DESCRIPTION: + +This macro generates the designator of the begin marker of the linker set +identified by @code{set}. The item at the begin marker address is the first +member of the linker set if it exists, e.g. the linker set is not empty. A +linker set is empty, if and only if the begin and end markers have the same +address. +@linkersetsset + +@page + +@subsection RTEMS_LINKER_SET_END - Designator of the linker set end marker + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_SET_END +@example +volatile type *end = RTEMS_LINKER_SET_END( set ); +@end example + +@subheading DESCRIPTION: + +This macro generates the designator of the end marker of the linker set +identified by @code{set}. The item at the end marker address is not a member +of the linker set. @linkersetsset + +@page + +@subsection RTEMS_LINKER_SET_SIZE - The linker set size in characters + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_SET_SIZE +@example +size_t size = RTEMS_LINKER_SET_SIZE( set ); +@end example + +@subheading DESCRIPTION: + +This macro returns the size of the linker set identified by @code{set} in +characters. @linkersetsset + +@page + +@subsection RTEMS_LINKER_ROSET_DECLARE - Declares a read-only linker set + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_ROSET_DECLARE +@example +RTEMS_LINKER_ROSET_DECLARE( set, type ); +@end example + +@subheading DESCRIPTION: + +This macro generates declarations for the begin and end markers of a read-only +linker set identified by @code{set}. @linkersetsset @linkersetstype + +@page + +@subsection RTEMS_LINKER_ROSET - Defines a read-only linker set + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_ROSET +@example +RTEMS_LINKER_ROSET( set, type ); +@end example + +@subheading DESCRIPTION: + +This macro generates definitions for the begin and end markers of a read-only +linker set identified by @code{set}. @linkersetsset @linkersetstype + +@page + +@subsection RTEMS_LINKER_ROSET_ITEM_DECLARE - Declares a read-only linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_ROSET_ITEM_DECLARE +@example +RTEMS_LINKER_ROSET_ITEM_DECLARE( set, type, item ); +@end example + +@subheading DESCRIPTION: + +This macro generates a declaration of an item contained in the read-only linker +set identified by @code{set}. @linkersetsset @linkersetstype @linkersetsitem + +@page + +@subsection RTEMS_LINKER_ROSET_ITEM_REFERENCE - References a read-only linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_ROSET_ITEM_REFERENCE +@example +RTEMS_LINKER_ROSET_ITEM_REFERENCE( set, type, item ); +@end example + +@subheading DESCRIPTION: + +This macro generates a reference to an item contained in the read-only linker set +identified by @code{set}. @linkersetsset @linkersetstype @linkersetsitem + +@page + +@subsection RTEMS_LINKER_ROSET_ITEM - Defines a read-only linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_ROSET_ITEM +@example +RTEMS_LINKER_ROSET_ITEM( set, type, item ); +@end example + +@subheading DESCRIPTION: + +This macro generates a definition of an item contained in the read-only linker set +identified by @code{set}. @linkersetsset @linkersetstype @linkersetsitem + +@page + +@subsection RTEMS_LINKER_ROSET_ITEM_ORDERED - Defines an ordered read-only linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_ROSET_ITEM_ORDERED +@example +RTEMS_LINKER_ROSET_ITEM_ORDERED( set, type, item, order ); +@end example + +@subheading DESCRIPTION: + +This macro generates a definition of an ordered item contained in the read-only +linker set identified by @code{set}. @linkersetsset @linkersetstype +@linkersetsitem @linkersetsorder + +@subheading NOTES: + +To be resilient to typos in the order parameter, it is recommended to use the +following construct in macros defining items for a particular linker set (see +enum in @code{XYZ_ITEM()}). + +@example +#include + +typedef struct @{ + int foo; +@} xyz_item; + +/* The XYZ-order defines */ +#define XYZ_ORDER_FIRST 0x00001000 +#define XYZ_ORDER_AND_SO_ON 0x00002000 + +/* Defines an ordered XYZ-item */ +#define XYZ_ITEM( item, order ) \ + enum @{ xyz_##item = order - order @}; \ + RTEMS_LINKER_ROSET_ITEM_ORDERED( \ + xyz, const xyz_item *, item, order \ + ) = @{ &item @} + +/* Example item */ +static const xyz_item some_item = @{ 123 @}; +XYZ_ITEM( some_item, XYZ_ORDER_FIRST ); +@end example + +@page + +@subsection RTEMS_LINKER_RWSET_DECLARE - Declares a read-write linker set + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_RWSET_DECLARE +@example +RTEMS_LINKER_RWSET_DECLARE( set, type ); +@end example + +@subheading DESCRIPTION: + +This macro generates declarations for the begin and end markers of a read-write +linker set identified by @code{set}. @linkersetsset @linkersetstype + +@page + +@subsection RTEMS_LINKER_RWSET - Defines a read-write linker set + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_RWSET +@example +RTEMS_LINKER_RWSET( set, type ); +@end example + +@subheading DESCRIPTION: + +This macro generates definitions for the begin and end markers of a read-write +linker set identified by @code{set}. @linkersetsset @linkersetstype + +@page + +@subsection RTEMS_LINKER_RWSET_ITEM_DECLARE - Declares a read-write linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_RWSET_ITEM_DECLARE +@example +RTEMS_LINKER_RWSET_ITEM_DECLARE( set, type, item ); +@end example + +@subheading DESCRIPTION: + +This macro generates a declaration of an item contained in the read-write linker +set identified by @code{set}. @linkersetsset @linkersetstype @linkersetsitem + +@page + +@subsection RTEMS_LINKER_RWSET_ITEM_REFERENCE - References a read-write linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_RWSET_ITEM_REFERENCE +@example +RTEMS_LINKER_RWSET_ITEM_REFERENCE( set, type, item ); +@end example + +@subheading DESCRIPTION: + +This macro generates a reference to an item contained in the read-write linker set +identified by @code{set}. @linkersetsset @linkersetstype @linkersetsitem + +@page + +@subsection RTEMS_LINKER_RWSET_ITEM - Defines a read-write linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_RWSET_ITEM +@example +RTEMS_LINKER_RWSET_ITEM( set, type, item ); +@end example + +@subheading DESCRIPTION: + +This macro generates a definition of an item contained in the read-write linker set +identified by @code{set}. @linkersetsset @linkersetstype @linkersetsitem + +@page + +@subsection RTEMS_LINKER_RWSET_ITEM_ORDERED - Defines an ordered read-write linker set item + +@subheading CALLING SEQUENCE: + +@findex RTEMS_LINKER_RWSET_ITEM_ORDERED +@example +RTEMS_LINKER_RWSET_ITEM_ORDERED( set, type, item, order ); +@end example + +@subheading DESCRIPTION: + +This macro generates a definition of an ordered item contained in the read-write +linker set identified by @code{set}. @linkersetsset @linkersetstype +@linkersetsitem @linkersetsorder + +@subheading NOTES: + +To be resilient to typos in the order parameter, it is recommended to use the +following construct in macros defining items for a particular linker set (see +enum in @code{XYZ_ITEM()}). + +@example +#include + +typedef struct @{ + int foo; +@} xyz_item; + +/* The XYZ-order defines */ +#define XYZ_ORDER_FIRST 0x00001000 +#define XYZ_ORDER_AND_SO_ON 0x00002000 + +/* Defines an ordered XYZ-item */ +#define XYZ_ITEM( item, order ) \ + enum @{ xyz_##item = order - order @}; \ + RTEMS_LINKER_RWSET_ITEM_ORDERED( \ + xyz, const xyz_item *, item, order \ + ) = @{ &item @} + +/* Example item */ +static const xyz_item some_item = @{ 123 @}; +XYZ_ITEM( some_item, XYZ_ORDER_FIRST ); +@end example diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am index 54b8555533..32ce1dad57 100644 --- a/testsuites/sptests/Makefile.am +++ b/testsuites/sptests/Makefile.am @@ -43,6 +43,7 @@ endif if HAS_THREADS_H _SUBDIRS += spstdthreads01 endif +_SUBDIRS += splinkersets01 _SUBDIRS += sptasknopreempt01 _SUBDIRS += spintrcritical23 _SUBDIRS += sptimecounter01 diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac index e6c51b4f52..2f50ceb568 100644 --- a/testsuites/sptests/configure.ac +++ b/testsuites/sptests/configure.ac @@ -46,6 +46,7 @@ AM_CONDITIONAL(HAS_SMP,test "$rtems_cv_RTEMS_SMP" = "yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +splinkersets01/Makefile spstdthreads01/Makefile spsyslock01/Makefile sptasknopreempt01/Makefile diff --git a/testsuites/sptests/splinkersets01/Makefile.am b/testsuites/sptests/splinkersets01/Makefile.am new file mode 100644 index 0000000000..ad70761f78 --- /dev/null +++ b/testsuites/sptests/splinkersets01/Makefile.am @@ -0,0 +1,23 @@ +rtems_tests_PROGRAMS = splinkersets01 +splinkersets01_SOURCES = init.c +splinkersets01_DEPENDENCIES = libsplinkersets01.a + +noinst_LIBRARIES = libsplinkersets01.a +libsplinkersets01_a_SOURCES = sets.c items.c + +dist_rtems_tests_DATA = splinkersets01.scn splinkersets01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(splinkersets01_OBJECTS) +LINK_LIBS = $(splinkersets01_LDLIBS) libsplinkersets01.a + +splinkersets01$(EXEEXT): $(splinkersets01_OBJECTS) $(splinkersets01_DEPENDENCIES) + @rm -f splinkersets01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/splinkersets01/init.c b/testsuites/sptests/splinkersets01/init.c new file mode 100644 index 0000000000..3d35a4e614 --- /dev/null +++ b/testsuites/sptests/splinkersets01/init.c @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "tmacros.h" + +#include "splinkersets01.h" + +const char rtems_test_name[] = "SPLINKERSETS 1"; + +RTEMS_LINKER_RWSET(test_rw_i, const int *); + +RTEMS_LINKER_ROSET(test_ro_i, const int *); + +RTEMS_LINKER_RWSET_DECLARE(test_rw_i, const int *); + +RTEMS_LINKER_ROSET_DECLARE(test_ro_i, const int *); + +const int a[4]; + +const int ca[5]; + +RTEMS_LINKER_RWSET_ITEM(test_rw, const int *, a3) = &a[3]; +RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw, const int *, a2, 2) = &a[2]; +RTEMS_LINKER_RWSET_ITEM_REFERENCE(test_rw, const int *, a1); +RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw, const int *, a0, 0) = &a[0]; + +/* Items are ordered lexicographically */ +RTEMS_LINKER_RWSET_ITEM(test_rw_i, const int *, a3) = &a[3]; +RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw_i, const int *, a2, 2) = &a[2]; +RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw_i, const int *, a1, 11) = &a[1]; +RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw_i, const int *, a0, 0) = &a[0]; + +#define OZ OA + +RTEMS_LINKER_ROSET_ITEM(test_ro, const int *, ca4) = &ca[4]; +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca3, OD) = &ca[3]; +RTEMS_LINKER_ROSET_ITEM_REFERENCE(test_ro, const int *, ca2); +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca1, OB) = &ca[1]; +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca0, OZ) = &ca[0]; + +RTEMS_LINKER_ROSET_ITEM(test_ro_i, const int *, ca4) = &ca[4]; +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca3, OD) = &ca[3]; +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca2, OC) = &ca[2]; +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca1, OB) = &ca[1]; +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro_i, const int *, ca0, OZ) = &ca[0]; + +/* + * Demonstrate safe (= define must exist) order definitions, otherwise typos + * are undetected and may lead to an unpredictable order. See also above OB + * vs. OZ. + */ + +#define SAFE_ORDER_A 00000 +#define SAFE_ORDER_B 00001 +#define SAFE_ORDER_C 00002 + +#define ITEM(i, o) \ + enum { test_ro_s_##i = o - o }; \ + RTEMS_LINKER_RWSET_ITEM_ORDERED(test_ro_s, const int *, i, o) = &i + +RTEMS_LINKER_RWSET(test_ro_s, const int *); + +static const int s0; +static const int s1; +static const int s2; + +ITEM(s2, SAFE_ORDER_C); +ITEM(s1, SAFE_ORDER_B); +ITEM(s0, SAFE_ORDER_A); + +static void test(void) +{ + const int * volatile *b = RTEMS_LINKER_SET_BEGIN(test_rw); + const int * volatile *e = RTEMS_LINKER_SET_END(test_rw); + const int * volatile const *cb = RTEMS_LINKER_SET_BEGIN(test_ro); + const int * volatile const *ce = RTEMS_LINKER_SET_END(test_ro); + const int * volatile *bi = RTEMS_LINKER_SET_BEGIN(test_rw_i); + const int * volatile *ei = RTEMS_LINKER_SET_END(test_rw_i); + const int * volatile const *cbi = RTEMS_LINKER_SET_BEGIN(test_ro_i); + const int * volatile const *cei = RTEMS_LINKER_SET_END(test_ro_i); + const int * volatile const *sb = RTEMS_LINKER_SET_BEGIN(test_ro_s); + const int * volatile const *se = RTEMS_LINKER_SET_END(test_ro_s); + size_t i; + + rtems_test_assert((size_t) (e - b) == RTEMS_ARRAY_SIZE(a)); + rtems_test_assert((size_t) (ce - cb) == RTEMS_ARRAY_SIZE(ca)); + rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_rw) == RTEMS_ARRAY_SIZE(a)); + rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_ro) == RTEMS_ARRAY_SIZE(ca)); + + rtems_test_assert((size_t) (ei - bi) == RTEMS_ARRAY_SIZE(a)); + rtems_test_assert((size_t) (cei - cbi) == RTEMS_ARRAY_SIZE(ca)); + rtems_test_assert((size_t) (se - sb) == 3); + rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_rw_i) == RTEMS_ARRAY_SIZE(a)); + rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_ro_i) == RTEMS_ARRAY_SIZE(ca)); + rtems_test_assert(RTEMS_LINKER_SET_SIZE(test_ro_s) == 3); + + for (i = 0; i < RTEMS_ARRAY_SIZE(a); ++i) { + rtems_test_assert(&a[i] == b[i]); + } + + for (i = 0; i < RTEMS_ARRAY_SIZE(ca); ++i) { + rtems_test_assert(&ca[i] == cb[i]); + } + + for (i = 0; i < RTEMS_ARRAY_SIZE(a); ++i) { + rtems_test_assert(&a[i] == bi[i]); + } + + for (i = 0; i < RTEMS_ARRAY_SIZE(ca); ++i) { + rtems_test_assert(&ca[i] == cbi[i]); + } + + rtems_test_assert(&s0 == sb[0]); + rtems_test_assert(&s1 == sb[1]); + rtems_test_assert(&s2 == sb[2]); +} + +static void Init(rtems_task_argument arg) +{ + TEST_BEGIN(); + + test(); + + TEST_END(); + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include diff --git a/testsuites/sptests/splinkersets01/items.c b/testsuites/sptests/splinkersets01/items.c new file mode 100644 index 0000000000..7ca6f53bb2 --- /dev/null +++ b/testsuites/sptests/splinkersets01/items.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "splinkersets01.h" + +RTEMS_LINKER_RWSET_ITEM_ORDERED(test_rw, const int *, a1, 1) = &a[1]; + +RTEMS_LINKER_ROSET_ITEM_ORDERED(test_ro, const int *, ca2, OC) = &ca[2]; diff --git a/testsuites/sptests/splinkersets01/sets.c b/testsuites/sptests/splinkersets01/sets.c new file mode 100644 index 0000000000..0cc1993925 --- /dev/null +++ b/testsuites/sptests/splinkersets01/sets.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "splinkersets01.h" + +RTEMS_LINKER_RWSET(test_rw, const int *); + +RTEMS_LINKER_ROSET(test_ro, const int *); diff --git a/testsuites/sptests/splinkersets01/splinkersets01.doc b/testsuites/sptests/splinkersets01/splinkersets01.doc new file mode 100644 index 0000000000..1dece7f8c2 --- /dev/null +++ b/testsuites/sptests/splinkersets01/splinkersets01.doc @@ -0,0 +1,25 @@ +This file describes the directives and concepts tested by this test set. + +test set name: splinkersets01 + +directives: + + - RTEMS_LINKER_SET_BEGIN() + - RTEMS_LINKER_SET_END() + - RTEMS_LINKER_SET_SIZE() + - RTEMS_LINKER_ROSET_DECLARE() + - RTEMS_LINKER_ROSET() + - RTEMS_LINKER_ROSET_ITEM_DECLARE() + - RTEMS_LINKER_ROSET_ITEM_REFERENCE() + - RTEMS_LINKER_ROSET_ITEM() + - RTEMS_LINKER_ROSET_ITEM_ORDERED() + - RTEMS_LINKER_RWSET_DECLARE() + - RTEMS_LINKER_RWSET() + - RTEMS_LINKER_RWSET_ITEM_DECLARE() + - RTEMS_LINKER_RWSET_ITEM_REFERENCE() + - RTEMS_LINKER_RWSET_ITEM() + - RTEMS_LINKER_RWSET_ITEM_ORDERED() + +concepts: + + - Ensure that the RTEMS linker sets work. diff --git a/testsuites/sptests/splinkersets01/splinkersets01.h b/testsuites/sptests/splinkersets01/splinkersets01.h new file mode 100644 index 0000000000..5da8ec6613 --- /dev/null +++ b/testsuites/sptests/splinkersets01/splinkersets01.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * 82178 Puchheim + * Germany + * + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef SPLINKERSET01_H +#define SPLINKERSET01_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include + +extern const int a[4]; + +extern const int ca[5]; + +RTEMS_LINKER_RWSET_DECLARE(test_rw, const int *); + +RTEMS_LINKER_ROSET_DECLARE(test_ro, const int *); + +RTEMS_LINKER_RWSET_ITEM_DECLARE(test_rw, const int *, a1); + +RTEMS_LINKER_ROSET_ITEM_DECLARE(test_ro, const int *, ca2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SPLINKERSET01_H */ diff --git a/testsuites/sptests/splinkersets01/splinkersets01.scn b/testsuites/sptests/splinkersets01/splinkersets01.scn new file mode 100644 index 0000000000..36c3cd12ff --- /dev/null +++ b/testsuites/sptests/splinkersets01/splinkersets01.scn @@ -0,0 +1,2 @@ +*** BEGIN OF TEST SPLINKERSETS 1 *** +*** END OF TEST SPLINKERSETS 1 *** -- cgit v1.2.3