Patch to add EH-related sections to MIPS linker scripts
Jeff Johnston
jjohnstn@redhat.com
Wed May 5 12:51:00 GMT 2004
Richard Sandiford wrote:
> Most of the linker scripts in libgloss/mips lack section statements
> for .eh_frame, .eh_frame_hdr, etc. We've got away with this in the
> past because the sections have traditionally been read-write, which
> causes ld's orphan code to place them next to .data. However, with
> recent gccs, the sections are read-only, so the orphan code tries to
> put them next to .rodata instead. Since these scripts don't create
> a .rodata section (it all goes in .rdata), the orphaned sections end
> up with a VMA of 0.
>
> It's difficult to know which scripts to change. I've only really
> been able to test ddb.ld and ddb-kseg0.ld, but lots of other scripts
> obviously came from the same source, and have the same problem.
> The patch below changes all those that obviously had the same
> ancestor as ddb.ld.
>
> Tested on mips64vrel-elf using the gcc testsuite. Also tested
> on real ddb boards. OK to install?
>
Yes, please go ahead.
-- Jeff J.
> Richard
>
>
> * mips/array.ld, mips/cfe.ld, mips/ddb-kseg0.ld, mips/ddb.ld,
> * mips/dve.ld, mips/idt32.ld, mips/idt64.ld, mips/idt.ld
> * mips/jmr3904app.ld, mips/lsi.ld, mips/nullmon.ld, mips/pmon.ld
> (.eh_frame_hdr, .eh_frame, .gcc_except_table, .jcr): New sections.
>
> Index: libgloss/mips/array.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/array.ld,v
> retrieving revision 1.2
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 array.ld
> *** libgloss/mips/array.ld 12 Jul 2002 15:37:03 -0000 1.2
> --- libgloss/mips/array.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 99,104 ****
> --- 99,108 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/cfe.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/cfe.ld,v
> retrieving revision 1.3
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 cfe.ld
> *** libgloss/mips/cfe.ld 20 Aug 2003 19:32:52 -0000 1.3
> --- libgloss/mips/cfe.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 54,59 ****
> --- 54,63 ----
> PROVIDE (etext = .);
> _etext = .;
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/ddb-kseg0.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/ddb-kseg0.ld,v
> retrieving revision 1.4
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 ddb-kseg0.ld
> *** libgloss/mips/ddb-kseg0.ld 7 Oct 2002 16:24:00 -0000 1.4
> --- libgloss/mips/ddb-kseg0.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 48,53 ****
> --- 48,57 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/ddb.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/ddb.ld,v
> retrieving revision 1.4
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 ddb.ld
> *** libgloss/mips/ddb.ld 7 Oct 2002 16:24:00 -0000 1.4
> --- libgloss/mips/ddb.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 48,53 ****
> --- 48,57 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/dve.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/dve.ld,v
> retrieving revision 1.3
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 dve.ld
> *** libgloss/mips/dve.ld 1 Aug 2002 20:21:23 -0000 1.3
> --- libgloss/mips/dve.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 48,53 ****
> --- 48,57 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/idt32.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idt32.ld,v
> retrieving revision 1.2
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 idt32.ld
> *** libgloss/mips/idt32.ld 12 Jul 2002 15:37:04 -0000 1.2
> --- libgloss/mips/idt32.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 57,62 ****
> --- 57,66 ----
> _etext = .;
>
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/idt64.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idt64.ld,v
> retrieving revision 1.2
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 idt64.ld
> *** libgloss/mips/idt64.ld 12 Jul 2002 15:37:04 -0000 1.2
> --- libgloss/mips/idt64.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 56,61 ****
> --- 56,65 ----
> PROVIDE (etext = .);
> _etext = .;
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/idt.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/idt.ld,v
> retrieving revision 1.4
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.4 idt.ld
> *** libgloss/mips/idt.ld 1 Aug 2002 20:21:23 -0000 1.4
> --- libgloss/mips/idt.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 55,60 ****
> --- 55,64 ----
> PROVIDE (etext = .);
> _etext = .;
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/jmr3904app.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/jmr3904app.ld,v
> retrieving revision 1.3
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 jmr3904app.ld
> *** libgloss/mips/jmr3904app.ld 1 Aug 2002 20:21:23 -0000 1.3
> --- libgloss/mips/jmr3904app.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 47,52 ****
> --- 47,56 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/lsi.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/lsi.ld,v
> retrieving revision 1.3
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 lsi.ld
> *** libgloss/mips/lsi.ld 1 Aug 2002 20:21:23 -0000 1.3
> --- libgloss/mips/lsi.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 47,52 ****
> --- 47,56 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/nullmon.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/nullmon.ld,v
> retrieving revision 1.3
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 nullmon.ld
> *** libgloss/mips/nullmon.ld 1 Aug 2002 20:21:23 -0000 1.3
> --- libgloss/mips/nullmon.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 49,54 ****
> --- 49,58 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
> Index: libgloss/mips/pmon.ld
> ===================================================================
> RCS file: /cvs/src/src/libgloss/mips/pmon.ld,v
> retrieving revision 1.3
> diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.3 pmon.ld
> *** libgloss/mips/pmon.ld 1 Aug 2002 20:21:23 -0000 1.3
> --- libgloss/mips/pmon.ld 16 Apr 2004 14:56:59 -0000
> *************** SECTIONS
> *** 49,54 ****
> --- 49,58 ----
> _etext = .;
> }
>
> + .eh_frame_hdr : { *(.eh_frame_hdr) }
> + .eh_frame : { KEEP (*(.eh_frame)) }
> + .gcc_except_table : { *(.gcc_except_table) }
> + .jcr : { KEEP (*(.jcr)) }
> .ctors :
> {
> /* gcc uses crtbegin.o to find the start of
More information about the Newlib
mailing list