undefined references in libc_nonshared.a when linking .so

chris cross xcross_ibm@yahoo.com
Mon Jul 18 20:14:00 GMT 2005


Hi,
Trying to link a shared object on FC3 and get some
confusing undefined references in libc_nonshared.a. I
isolated it to when I pass -shared as a linker option,
as in "gcc -Wl,-shared". When I use the gcc option,
"gcc -shared" I don't get the problem. 

If I google one of the missing references I see
sporadic hits of people crying that they can't build
their favorite program. A few discuss linker scripts
but don't end with a conclusive answer.

I don't know much about linking nor do I know much
about how gcc invokes ld. This smells like some kind
of mismatch between glibc and binutils. Can anyone
help?

thanks,
chris

error listing:

gcc -Wl,-shared -o slibtest.so slibtest.o
/usr/lib/libc_nonshared.a(elf-init.oS)(.text+0x1c): In
function `__libc_csu_init':
: undefined reference to `__init_array_end'
/usr/lib/libc_nonshared.a(elf-init.oS)(.text+0x22): In
function `__libc_csu_init':
: undefined reference to `__init_array_start'
/usr/lib/libc_nonshared.a(elf-init.oS)(.text+0x68): In
function `__libc_csu_fini':
: undefined reference to `__fini_array_end'
/usr/lib/libc_nonshared.a(elf-init.oS)(.text+0x6e): In
function `__libc_csu_fini':
: undefined reference to `__fini_array_start'
/usr/bin/ld: slibtest.so: hidden symbol
`__fini_array_end' isn't defined
/usr/bin/ld: final link failed: Nonrepresentable
section on output
collect2: ld returned 1 exit status


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Gcc-help mailing list