[uClinux-dev] Does ucfront work with libstdc++.a?

Wolfgang Mües wolfgang at iksw-muees.de
Sun Oct 21 17:17:53 EDT 2007


Erwin,

On Sonntag, 21. Oktober 2007, Erwin Authried wrote:
> in elf2flt.ld, the ctor table starts with the nr. of entries in the
> table "LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)", and ends with
> 0.
Yes. 

> The newer compilers just have the ctor entries, and 0xffffffff as 
> the end marker (if I remember correctly). The end marker isn't
> required in the ld script because it comes from the library.

OK.
> Because of the elf2flt.ld entries, you will see multiple definitions 
> of the  __CTOR_LIST__, __DTOR_LIST__ entries. It's possible that this
> doesn't cause any harm, but it's rather confusing, at least. The main 
> problem with the 3.4 was the fact that the library for calling the 
> ctors/dtors is compiled without -msingle-pic-base, causing a crash.

This is my linker script:

> 		. = ALIGN(4) ;
> 		__CTOR_LIST__ = .;
> 		LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
> SINGLE_LINK:	/* gcc uses crtbegin.o to find the start of
> SINGLE_LINK:	   the constructors, so we make sure it is
> SINGLE_LINK:	   first.  Because this is a wildcard, it
> SINGLE_LINK:	   doesn't matter if the user does not
> SINGLE_LINK:	   actually link against crtbegin.o; the
> SINGLE_LINK:	   linker won't look for a file to match a
> SINGLE_LINK:	   wildcard.  The wildcard also means that it
> SINGLE_LINK:	   doesn't matter which directory crtbegin.o
> SINGLE_LINK:	   is in.  */
> SINGLE_LINK:	KEEP (*crtbegin*.o(.ctors))
> SINGLE_LINK:	/* We don't want to include the .ctor section from
> SINGLE_LINK:	   from the crtend.o file until after the sorted ctors.
> SINGLE_LINK:	   The .ctor section from the crtend file contains the
> SINGLE_LINK:	   end of ctors marker and it must be last */
> SINGLE_LINK:	KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
> SINGLE_LINK:	KEEP (*(SORT(.ctors.*)))
> 		KEEP (*(.ctors))
> 		LONG(0)
> 		__CTOR_END__ = .;
> 		__DTOR_LIST__ = .;
> 		LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
> SINGLE_LINK:	KEEP (*crtbegin*.o(.dtors))
> SINGLE_LINK:	KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
> SINGLE_LINK:	KEEP (*(SORT(.dtors.*)))
> 		KEEP (*(.dtors))
> 		LONG(0)
> 		__DTOR_END__ = .;

Can you show me how to modify this for gcc 4.0.x?

And many thanks for your explanations!

regards
Wolfgang
-- 
Das Leben kann nur rückwärts verstanden,
muß aber vorwärts gelebt werden.


More information about the uClinux-dev mailing list