libgloss/arm fixes
Mark Salter
msalter@redhat.com
Tue Feb 5 10:17:00 GMT 2002
Just checked this in.
--Mark
2002-02-05 Mark Salter <msalter@redhat.com>
* arm/elf-iq80310.specs: Ditto.
* arm/elf-redboot.specs: Ditto.
* arm/elf-redboot.ld: Fix eh_frame sections. Add .jcr section.
* arm/redboot-crt0.S: Add support for __USES_INITFINI__.
Index: arm/elf-iq80310.specs
===================================================================
RCS file: /cvs/src/src/libgloss/arm/elf-iq80310.specs,v
retrieving revision 1.1
diff -u -p -5 -r1.1 elf-iq80310.specs
--- elf-iq80310.specs 2002/01/07 18:12:32 1.1
+++ elf-iq80310.specs 2002/02/05 17:44:21
@@ -2,7 +2,7 @@
*link:
-T redboot.ld%s -Ttext 0xA0020000 %(old_link)
*startfile:
-crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s
+crti%O%s crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s
Index: arm/elf-redboot.ld
===================================================================
RCS file: /cvs/src/src/libgloss/arm/elf-redboot.ld,v
retrieving revision 1.1
diff -u -p -5 -r1.1 elf-redboot.ld
--- elf-redboot.ld 2002/01/07 18:12:32 1.1
+++ elf-redboot.ld 2002/02/05 17:44:21
@@ -100,10 +100,11 @@ SECTIONS
{
KEEP (*(.fini))
} =0
.rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) }
.rodata1 : { *(.rodata1) }
+ .eh_frame_hdr : { *(.eh_frame_hdr) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN(256) + (. & (256 - 1));
.data :
{
@@ -111,11 +112,11 @@ SECTIONS
*(.data.*)
*(.gnu.linkonce.d*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
- .eh_frame : { *(.eh_frame) }
+ .eh_frame : { KEEP (*(.eh_frame)) }
.gcc_except_table : { *(.gcc_except_table) }
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
@@ -140,10 +141,11 @@ SECTIONS
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
+ .jcr : { KEEP (*(.jcr)) }
.got : { *(.got.plt) *(.got) }
.dynamic : { *(.dynamic) }
/* We want the small data sections together, so single-instruction offsets
can access them all, and initialized data all before uninitialized, so
we can shorten the on-disk segment size. */
Index: arm/elf-redboot.specs
===================================================================
RCS file: /cvs/src/src/libgloss/arm/elf-redboot.specs,v
retrieving revision 1.1
diff -u -p -5 -r1.1 elf-redboot.specs
--- elf-redboot.specs 2002/01/07 18:12:32 1.1
+++ elf-redboot.specs 2002/02/05 17:44:21
@@ -2,7 +2,7 @@
*link:
-T redboot.ld%s -Ttext 0x20000 %(old_link)
*startfile:
-crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s
+crti%O%s crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s
Index: arm/redboot-crt0.S
===================================================================
RCS file: /cvs/src/src/libgloss/arm/redboot-crt0.S,v
retrieving revision 1.2
diff -u -p -5 -r1.2 redboot-crt0.S
--- redboot-crt0.S 2002/01/24 13:33:55 1.2
+++ redboot-crt0.S 2002/02/05 17:44:21
@@ -47,22 +47,37 @@ __change_mode:
bl SYM_NAME(__get_memtop)
sub r0, r0, #32
mov sp, r0
+#ifdef __USES_INITFINI__
+ /* Some arm/elf targets use the .init and .fini sections
+ to create constructors and destructors, and for these
+ targets we need to call the _init function and arrange
+ for _fini to be called at program exit. */
+ ldr r0, .Lfini
+ bl SYM_NAME (atexit)
+ bl SYM_NAME (_init)
+#endif
+
mov a1, #0
ldr a2, .LC3
mov a3, a2
bl SYM_NAME(main)
1: bl SYM_NAME(exit)
b 1b
+ .align 2
.LC1:
.word __bss_start__
.LC2:
.word __bss_end__
.LC3:
.word 0
+#ifdef __USES_INITFINI__
+.Lfini:
+ .word SYM_NAME(_fini)
+#endif
#if 0
#ifdef __thumb__
.code 16
#endif
More information about the Newlib
mailing list