[uClinux-dev] [patch] Support C++ in elf2flt.ld.

Kazu Hirata kazu at codesourcery.com
Thu Oct 4 17:15:35 EDT 2007


Hi,

Attached is a patch to fix elf2flt.ld so that C++ programs will link
successfully.

Nathan Sidwell says:

  "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."

Tested on m68k-uclinux.  OK?

Kazu Hirata

Index: elf2flt.ld
===================================================================
RCS file: /var/cvs/elf2flt/elf2flt.ld,v
retrieving revision 1.15
diff -u -d -p -r1.15 elf2flt.ld
--- elf2flt.ld	21 Jul 2006 13:11:04 -0000	1.15
+++ elf2flt.ld	2 Oct 2007 16:40:44 -0000
@@ -59,9 +59,6 @@ R_RODAT		*(.gnu.linkonce.r*)
 		*(.data1)
 		*(.data.*)
 		*(.gnu.linkonce.d*)
-		*(.data1)
-		*(.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 */
@@ -133,10 +130,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) ;


More information about the uClinux-dev mailing list