Linking with -lc

Harris, Jeff JeffH@aiinet.com
Wed May 7 20:40:00 GMT 2003


The enclosed test works fine.  Looking at the glibc Versions file for the
nofpu powerpc, it looks as if it is ppc specific.  I've included a small
test case which demonstrates the problem.

> CC=/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc make all
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -fPIC   -c -o
fplib.o fplib.c
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -shared -o
libcfp.so fplib.o
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -fPIC   -c -o
fp1.o fp1.c
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -g fp1.o -o cfp
-L. -lcfp

Compiles just fine.  However:

> CC=/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc make all
SOFLAGS=-lc
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -fPIC   -c -o
fplib.o fplib.c
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -shared -o
libcfp.so fplib.o -lc
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -fPIC   -c -o
fp1.o fp1.c
/usr/local/ai/ppc8xx-lx2.4-1.00rc4/bin/powerpc-ai-linux-gcc -g fp1.o -o cfp
-L. -lcfp
./libcfp.so: undefined reference to `__muldf3@GLIBC_2.3.2'
collect2: ld returned 1 exit status
make: *** [cfp] Error 1

Fails.  The test also succeeds using a compiler for Linux/x86.

Would it suffice to just add the symbols in the Versions file to the .hidden
section of libgcc-compat.S?


Jeff

-----Original Message-----
From: H. J. Lu [mailto:hjl@lucon.org] 
Sent: Wednesday, May 07, 2003 4:09 PM
To: Harris, Jeff
Cc: amodra@bigpond.net.au; 'binutils@sources.redhat.com'
Subject: Re: Linking with -lc


On Wed, May 07, 2003 at 12:47:17PM -0700, H. J. Lu wrote:
> On Wed, May 07, 2003 at 03:38:49PM -0400, Harris, Jeff wrote:
> > The output from the objdump command is:
> > 
> > 00114fa4 g    DF .text  00000894  GLIBC_2.3.2 __muldf3
> 
> This definitely is wrong. __muldf3 in glibc should be for backward
> compatibility only. Someone working on pcc should take a look at
> sysdeps/powerpc/nofpu/Versions and fix them similar to the way in
> sysdeps/powerpc/powerpc32/libgcc-compat.S.
> 
> > 
> > I didn't mention in my original email, but linking with -lgcc before -lc
> > works.  This is what happens when gcc calls ld from the output of gcc
-v.
> > 
> 
> I will see if I can reproduce it on Linux/x86. I suspect it is a ppc
> specific bug.
> 

The enclosed testcase works fine on Linux/x86. Please try it on your
ppc box. If it doesn't work for you, that means there is a ppc specific
bug. If it does work for you, you need to provide a small testcase to
show how to reproduce it.


H.J.
--
# make
cc -fPIC   -c -o ref.o ref.c
cc -fPIC   -c -o foo.o foo.c
ld -o foo.so -shared --version-script=foo.v foo.o -rpath .
ar rv foo.a foo.o
r - foo.o
ld -o ref.so -shared ref.o foo.so foo.a -rpath .
cc    -c -o main.o main.c
cc -o main main.o ref.so foo.so

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpbug.tgz
Type: application/octet-stream
Size: 558 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030507/32f05195/attachment.obj>


More information about the Binutils mailing list