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

David McCullough David_Mccullough at securecomputing.com
Thu Oct 11 19:40:36 EDT 2007


Jivin Kazu Hirata lays it down ...
> Hi,

Sorry for taking a while to reply to this,  holidays and other lame
excuses :-)

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

With a newer compiler version I am guessing,  they currently link and
work correctly depending on your platform and/or compiler version :-)

> 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?

Why didn't you just put the new .eh_frame_hdr in like the others ?
They are included  in the output already and since you moved _edata
to after .gcc_except_table I don't see the gain.

Could you try the attached patch and see if that works ?

Thanks,
Davidm

> 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) ;
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
> 

-- 
David McCullough,  david_mccullough at securecomputing.com,   Ph:+61 734352815
Secure Computing - SnapGear  http://www.uCdot.org http://www.cyberguard.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf2flt-eh_frame_hdr.patch
Type: text/x-diff
Size: 409 bytes
Desc: not available
Url : http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20071012/70a0aa20/elf2flt-eh_frame_hdr.bin


More information about the uClinux-dev mailing list