shared libstdc++

Lei Sun lei_sun at comcast.net
Wed Jan 18 01:02:42 UTC 2006


> Jivin Lei Sun lays it down ...
>> Hi:
>>   I am having trouble runing C++ application uClinux, the elf2flt 
>> couldn't product correct binary with pic_and_got set, I disabled the 
>> shared lib support in uClibc, so all the C program is OK. But I got 
>> "reloc outside program"error when loading C++ application, the problem is 
>> that buildroot automatically built the gcclib and libstdc++ with PIC and 
>> GOT,  the elf2flt linker script grep the C++ binary and found 
>> "GLOBAL_OFFSET_TABLE"  and then set the pic_and_got, therefore , created 
>> faulty binary( I think it has some bugs).
>>   As Mike pointed that uClinux list doesn't response question regarding 
>> elf2flt.
>
> Thats unusual,  and I haven't seen too many questions go unanswered.
> On the uClinux-dve list,  no answer usually means no one knows the answer 
> :-)
>
>> My question is, do i have to build gcc with -enable-shared option? as 
>> specified in buildroot's Makefile? if not, should buildroot add an option 
>> to let user select shared option when building gcclib?
>
> First I would ask what platform are you building for ?
> What compiler version are you building ?

I was using ARM platform with NO-MMU, compiler is gcc-3.4.2

> You can only do shared libraries for uClinux on m68k at the moment,  and
> no one has gone close to making a libstdc++ shared lib for uClinux on
> m68k.

Take a look at the buildroot script, on 2nd stage of buidling gcc, the 
script configured the gcc with --enable-shared , that's where libstdc++ 
shared were created.

> My guess is that you are mixing up MMU shared libraries with uClinux and
> they just don't work.  Under uClinux you will never used the '-shared'
> compile option and you are unlikely to use -fPIC (except for XIP on arm
> platforms,  and then you need the XIP support in the compiler).

What do you mean by "MMU shared libraries" ,  I finally figured out that 
libgcc.a  was built with -fPIC flag! thus every lib depends on libgcc.a will 
has GOT in it.  the file gcc-3.4.2/gcc/config/arm/t-linux  is the evil that 
silently set the -fPIC. I was able to removed that and rebuilt the 
stdlibc++.a  , now I could compile C++ application.
Still don't quite understand why -fPIC was used for libgcc.a

Thank you for your response!
lei

> Cheers,
> Davidm
>
> -- 
> David McCullough, davidm at cyberguard.com.au, Custom Embedded Solutions + 
> Security
> Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org 
> http://www.cyberguard.com 




More information about the uClibc mailing list