This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linking with -lc


I am experiencing a strange linking problem since upgrading my binutils to
2.14.90.0.1.  I have a GCC version 3.2.3 cross-compiler for powerpc with
soft floating point.  I am using GLIBC 2.3.2.

I have a shared library which uses floating point operations.  I build it
as:
	powerpc-ai-linux-gcc -g fplib.c -shared -o libcfp.so
As a result, it defines __muldf3 as a local text symbol in libcfp.so.

If, however, I build it as:
	powerpc-ai-linux-gcc -g fplib.c -shared -o libcfp.so -lc
The __muldf3 symbol is an undefined global symbol: __muldf3@@GLIBC_2.3.2.

This occurs whether I'm using the old (2.13.90.0.20) or new binutils.  The
different symbol definitions are due to ld finding the __muldf3 symbol in
libgcc.a (the first case) or libc.so.6 (the second case)

My problem comes in linking a program against the libcfp.so library.  If I
have a program which also uses soft floating point operations, the program
fails to link with the libcfp built with -lc:
	/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -g fp1.c
-o cfp1 -L. -lcfp
	./libcfp.so: undefined reference to `__muldf3@GLIBC_2.3.2'
	collect2: ld returned 1 exit status

If I remove the -lc flag in the link of libcfp.so, the cfp1 program links
successfully.  This situation also works in both cases using the
2.13.90.0.20 binutils.  I can not use the 2.13 binutils due to a bug with ld
relating to printf statements and -O2 optimizations.  The 2.14 version fixes
the ld crash.

It seems safe enough to remove -lc flag, but it is being added in some third
party packages which we are importing and would prefer not to have to
modify.

Is there anything I can do to fix this situation without modifying the
package?  It seems like a bug in the loader or perhaps a deprecated feature.
I would appreciate any suggestions.

Thanks,
Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]