RFA: RX: Move init functions into .text section
Nick Clifton
nickc@redhat.com
Wed Nov 4 16:47:00 GMT 2015
Hi DJ,
Current the RX linker script in libgloss/rx puts the language
initialisation arrays into the .data section. The patch below moves
them into the .text section. This matters when running on an RX in
big-endian-data mode since byte swapping is different for data and
code.
OK to apply ?
Cheers
Nick
libgloss/ChangeLog
2015-11-04 Nick Clifton <nickc@redhat.com>
* rx/rx-sim.ld: Move init and fini arrays into .text section.
diff --git a/libgloss/rx/rx-sim.ld b/libgloss/rx/rx-sim.ld
index a9bbf1f..89b5a95 100644
--- a/libgloss/rx/rx-sim.ld
+++ b/libgloss/rx/rx-sim.ld
@@ -61,6 +61,25 @@ SECTIONS
. = ALIGN(4);
KEEP (*(.init))
KEEP (*(.fini))
+ KEEP (*(.tm_clone_table))
+
+ /* NB: init_array and friends are marked as EXECUTABLE, so they
+ must be placed in the .text section not the .data section. If
+ they are placed in the .data section then section will inherit
+ the EXECUTABLE attribute and so become subject to weird byte
+ swapping protocols in big-endian data mode. */
+ PROVIDE (__preinit_array_start = .);
+ KEEP (*(.preinit_array))
+ PROVIDE (__preinit_array_end = .);
+ PROVIDE (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array))
+ PROVIDE (__init_array_end = .);
+ PROVIDE (__fini_array_start = .);
+ KEEP (*(.fini_array))
+ KEEP (*(SORT(.fini_array.*)))
+ PROVIDE (__fini_array_end = .);
+ LONG(0); /* Sentinel. */
} > RAM
.rodata : {
@@ -78,19 +97,6 @@ SECTIONS
.data : {
. = ALIGN(4);
PROVIDE (__datastart = .);
- PROVIDE (__preinit_array_start = .);
- KEEP (*(.preinit_array))
- PROVIDE (__preinit_array_end = .);
- PROVIDE (__init_array_start = .);
- KEEP (*(SORT(.init_array.*)))
- KEEP (*(.init_array))
- PROVIDE (__init_array_end = .);
- PROVIDE (__fini_array_start = .);
- KEEP (*(.fini_array))
- KEEP (*(SORT(.fini_array.*)))
- PROVIDE (__fini_array_end = .);
- LONG(0); /* Sentinel. */
-
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
More information about the Newlib
mailing list