OSDN Git Service

Kazu Hirata wrote:
authorDavid McCullough <davidm@snapgear.com>
Thu, 27 Nov 2008 01:08:04 +0000 (01:08 +0000)
committerDavid McCullough <davidm@snapgear.com>
Thu, 27 Nov 2008 01:08:04 +0000 (01:08 +0000)
> Attached is a patch to fix elf2flt.ld so that C++ programs will link
> successfully.
>
> Nathan Sidwell says:
> nathan@codesourcery.com
>
>   "The problem is the .eh_frame_hdr optimization. firstly that input
>   section was not mentioned in the linker script and secondly, the
>   linker requires .eh_frame_hdr and .eh_frame section in the output,
>   so it can optimize them. I move gcc_except_table out of .data, for
>   consistency."

I've been trying to get CVS binutils up and running on the Blackfin, and
after debugging a C++ link failure I eventually tracked it down to the
elf2flt linker script, and google pointed me at this thread which I'd
completely forgotten in the meantime.  The patch is needed, please apply
to elf2flt.

Bernd Schmidt <bernds_cb1@t-online.de>

elf2flt.ld

index a16a9c8..19eab7c 100644 (file)
@@ -59,9 +59,6 @@ R_RODAT               *(.gnu.linkonce.r*)
                *(.data1)
                *(.data.*)
                *(.gnu.linkonce.d*)
-               *(.eh_frame_hdr)
-               *(.eh_frame)
-               *(.gcc_except_table)
 
                /* Microblaze has .sdata and .sbss (small bss).  They must
                   be contiguous, so please don't move any of this. JW */
@@ -134,10 +131,15 @@ SINGLE_LINK:      KEEP (*(SORT(.dtors.*)))
                KEEP (*(SORT(.fini_array.*)))
                PROVIDE (__fini_array_end = .);
 
-               . = ALIGN(0x10) ; 
-               _edata = . ;
        } > flatmem
 
+       .eh_frame_hdr : { *(.eh_frame_hdr) } > flatmem
+       .eh_frame : { KEEP(*(.eh_frame)) } > flatmem
+       .gcc_except_table : { KEEP(*(.gcc_except_table)) } >flatmem
+
+       . = ALIGN(0x10) ; 
+       _edata = . ;
+
        .bss : {
                . = ALIGN(0x4) ;
                _sbss = ALIGN(0x4) ;