libstdc++ issues and umoddi3

Mwanguhya Daniel Murungi dmurungi at dicts.mak.ac.ug
Sat Aug 8 01:37:17 PDT 2009


On Monday 03 August 2009 10:37:39 am Mwanguhya Daniel Murungi wrote:
> Hello guys,
>
> Am having a problem linking against libstdc++. Linking against libstdc++
> generates the following errors;
>
> anchor:/anchor-toolchain/onward/packages/phase-two/gcc$ gcc t.c -lstdc++
> /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.
>4/../../../libssp.so: warning: the 'gets' function is dangerous and should
> not be used.
> /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.
>4/../../../libstdc++.so: undefined reference to `_Unwind_Resume_or_Rethrow'
> /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.
>4/../../../libstdc++.so: undefined reference to `_Unwind_RaiseException'
> /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.
>4/../../../libstdc++.so: undefined reference to
> `_Unwind_GetLanguageSpecificData'
> ...
> collect2: ld returned 1 exit status
>
> --t.c------------------------------
> #include <stdio.h>
> int main()
> {
>         printf("test\n");
>         return 0;
> }
> -------------------------------------
>
> The _Unwind* functions are defined in libgcc_s. When I link against
> libgcc_s, i get the following error;
>
> $ gcc t.c -lstdc++ -lgcc_s
>
> $ ./a.out
> Can't modify /anchor-tools/lib/libstdc++.so.6's text section. Use GCC
> option -fPIC for shared objects, please.
>
> Can someone please tell me the cause of the above error and how to get rid
> of it.
>
> NB: am using gcc 4.2.4 and uClibc-0.9.30.1
>
> Attached is the verbose out from running 'gcc -v t.c -Wl,--verbose'

Found my problem! Compiling t.c with the options `-fno-PIE -nopie` reveals the 
error; a reference to a hidden symbol `__umoddi3` 

-- compile log ---
gcc   t.c  -lstdc++ -fno-PIE -nopie
/anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/../../../libssp.so: 
warning: the 'gets' function is dangerous and should not be used.
/anchor-tools/bin/ld: a.out: hidden symbol `__umoddi3' 
in /anchor-toolchain/anchor-tools/bin/../lib/gcc/i486-anchor-linux-uclibc/4.2.4/libgcc
.a(_umoddi3.o) is referenced by DSO
/anchor-tools/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
------------------------------------------------------------------------------------------------------------

grep shows that the symbol is defined in libc-2.7.so and libc.so.6 but not 
libc.so.0. 

I added --with-lib-path=/anchor-tools/lib but i still get the error mentioned 
above when linking against libstdc++.

Has anyone experienced the above error? Any help would be greatly appreciated.




More information about the hlfs-dev mailing list