gcc -shared ... -lc ?
Thomas Bogendoerfer
maintainerHi,
while compiling redhat 5.0 rpms, I've found something very strange, when building shared libraries. Some of the built shared libs are very big and a nm on them shows, that the whole libc (I guess so) is included. Binaries inked against these library just dump core. The built line for these shared libs always ends with a -lc. Now I'm wondering wether this is a ld bug or just a user error. What's really weird is the following patch from one of the redhat rpms:
Makefile Tue Jul 8 11:08:12 1997 renamed from Makefile.ewt Tue Jul 8 11:08:00 1997 +1 -1
@@ -41,7 +41,7 @@ $(SHARED_LIB): $(OBJS) cd pic; \ - $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) + $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) -lc pic: -if [ ! -d pic ]; then mkdir pic; fi
So it looks like the ld for alpha and i386 don't include the whole libc when linked with the comand line above. Any hints ?
Thomas.
Signature · 3 lines
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
[Linus Torvalds in <[email protected]>] This is a bug in binutils. I think it is fixed in version 2.8.1. Ralf is
more familiar with the problem.
_Tim
Quoted 32 lines · Thomas Bogendoerfer
Hi,
while compiling redhat 5.0 rpms, I've found something very strange, when building shared libraries. Some of the built shared libs are very big and a nm on them shows, that the whole libc (I guess so) is included. Binaries inked against these library just dump core. The built line for these shared libs always ends with a -lc. Now I'm wondering wether this is a ld bug or just a user error. What's really weird is the following patch from one of the redhat rpms:
Makefile Tue Jul 8 11:08:12 1997 renamed from Makefile.ewt Tue Jul 8 11:08:00 1997 +1
-1@@ -41,7 +41,7 @@ $(SHARED_LIB): $(OBJS) cd pic; \ - $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) + $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) -lc pic: -if [ ! -d pic ]; then mkdir pic; fiSo it looks like the ld for alpha and i386 don't include the whole libc when linked with the comand line above. Any hints ?
Thomas.
Signature · 3 lines
See, you not only have to be a good coder to create a system like Linux, you have to be a sneaky bastard too ;-) [Linus Torvalds in <[email protected]>]
Quoted 11 lines · Thomas Bogendoerfer
while compiling redhat 5.0 rpms, I've found something very strange, when building shared libraries. Some of the built shared libs are very big and a nm on them shows, that the whole libc (I guess so) is included. Binaries inked against these library just dump core. The built line for these shared libs always ends with a -lc. Now I'm wondering wether this is a ld bug or just a user error. What's really weird is the following patch from one of the redhat rpms:
Makefile Tue Jul 8 11:08:12 1997 line 47
Quoted 8 lines
Makefile Tue Jul 8 11:08:12 1997 renamed from Makefile.ewt Tue Jul 8 11:08:00 1997 +1
-1@@ -41,7 +41,7 @@ $(SHARED_LIB): $(OBJS) cd pic; \ - $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) + $(CC) -shared -o ../$@ -Wl,-soname,$(SONAME_SHARED_LIB) $(OBJS) -lc pic: -if [ ! -d pic ]; then mkdir pic; fi
The code of libtermcap.so contains dependencies of the libc version it was compiled with, that's why it has to be linked against libc. Most old libraries were not linked against libc. This became a problem when with the introduction of libc6 the case of having multiple libc linked into a program had to be handled. For example:
vi
|--> libtermcap.so.2
|--> libc.so.6
|--> libc.so.5
The of course only work right when libtermcap has been linked against libc.
Quoted 2 lines
So it looks like the ld for alpha and i386 don't include the whole libc when linked with the comand line above. Any hints ?
This is a binutils 2.7 bug. Upgrading to 2.8.1 solves the problem.
Ralf
Thomas Bogendoerfer
maintainerQuoted 4 lines
Quoted 2 lines
So it looks like the ld for alpha and i386 don't include the whole libc when linked with the comand line above. Any hints ?
This is a binutils 2.7 bug. Upgrading to 2.8.1 solves the problem.
this is with binutils-2.8.1
Thomas.
Signature · 3 lines
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
[Linus Torvalds in <[email protected]>]Quoted 3 lines
Quoted 1 line
This is a binutils 2.7 bug. Upgrading to 2.8.1 solves the problem.
this is with binutils-2.8.1
Oh good its not me seeing things. Ralf - could there be two sets of your binutils-2.8.1 one working one not and could you maybe post MD5 hashes of your binaries you know work ?
Thomas Bogendoerfer
maintainerQuoted 7 lines · Alan Cox
Quoted 3 lines
Quoted 1 line
This is a binutils 2.7 bug. Upgrading to 2.8.1 solves the problem.
this is with binutils-2.8.1
Oh good its not me seeing things. Ralf - could there be two sets of your binutils-2.8.1 one working one not and could you maybe post MD5 hashes of your binaries you know work ?
I'm using the little endian rpm from ftp.linux.sgi.com. Here is the md5sum:
bce052ce002cbe434133cecf2c4a4f10 binutils-2.8.1-1.mips.rpm
and:
Linux mips.franken.de 2.1.72 #140 Sat Jan 3 23:43:04 MET 1998 mips [root@mips /root]# ld --version
GNU ld 2.8.1
Copyright 1997 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty.
Supported emulations:
elf32lmip
elf32bmip
mipslit
mipsbig
I'm sure the binutils 2.7, I've used before, didn't have the bug. But I wanted to make the redhat-5.0 rpms with the newer binutils.
Thomas.
Signature · 3 lines
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
[Linus Torvalds in <[email protected]>]Quoted 7 lines · Alan Cox
Quoted 3 lines
Quoted 1 line
This is a binutils 2.7 bug. Upgrading to 2.8.1 solves the problem.
this is with binutils-2.8.1
Oh good its not me seeing things. Ralf - could there be two sets of your binutils-2.8.1 one working one not and could you maybe post MD5 hashes of your binaries you know work ?
Right now I suspect a packaging problem because for me everything is working fine. Maybe one of you could verify that it's actually the ld from binutils 2.8.1 that is installed on your systems rsp. contained in the packages you've used to install? Check the output of ``ld -v''.
I'll post the MD5 sums later when I return home.
Ralf
Thomas Bogendoerfer
maintainerQuoted 6 lines · Thomas Bogendoerfer
Quoted 4 lines
Quoted 2 lines
So it looks like the ld for alpha and i386 don't include the whole libc when linked with the comand line above. Any hints ?
This is a binutils 2.7 bug. Upgrading to 2.8.1 solves the problem.
this is with binutils-2.8.1
Ok, I've found the problem. The installed binutils are 2.8.1, but the binutils gcc used were 2.7. They got used by gcc, because they were in /usr/mipsel-linux/bin. I've removed them and all works fine now.
Sorry for the false alarm.
Thomas.
Signature · 3 lines
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
[Linus Torvalds in <[email protected]>]