bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/2607] linker doesn't recognize an ELF library.


From: scp at predict dot com
Subject: [Bug ld/2607] linker doesn't recognize an ELF library.
Date: 9 May 2006 19:39:44 -0000

------- Additional Comments From scp at predict dot com  2006-05-09 19:39 
-------

I have just run into what I believe is the same problem. It appears to be due to
a new version of the Sun ld (/usr/ccs/bin/ld) which was installed recently on
our Solaris8 systems as part of trying to patch up the Sun ONE Studio 8 and Sun
Studio 10 compiler suites. Sun's ld will happily recognize the shared objects
produced by the new ld, but binutil 2.16 (and 2.16.1)'s bfd library will not.

Further investigation showed that the shared library in question was the only
one in our codebase with this problem, and it happens to be the only shared
library in our codebase in which the source files (i.e. *.o object files going
in) were compiled with the Sun C compiler), but the shared library was created
using the Sun C++ driver (i.e. CC -G ...). Furthermore, the problem occurs
because /usr/ccs/bin/ld is invoked with the option
-zld32=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libCCexcept.so.1, which
contains exception handling support. Invoking the equivalent /usr/ccs/bin/ld
command minus that command line option, the resulting library is handled without
problem by binutils.

The workaround for us has been to create the shared library using cc -G instead
of CC -G in the case where there are no C++ sources in the shared library.

I should emphasize that /usr/ccs/bin/ld is perfectly happy with the resulting
shared objects no matter how they were created.

Here's a few more details:

% ls -l /usr/ccs/bin/ld
-rwxr-xr-x  1 root bin 7824 Oct 27  2005 /usr/ccs/bin/ld*
% cksum /usr/ccs/bin/ld
3259439703 7824 /usr/ccs/bin/ld

% ls -l /usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libCCexcept.so.1
-rwxrwxr-x  1 root sys 12320 Mar 13  2003
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libCCexcept.so.1*
% cksum /usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libCCexcept.so.1
4099598650 12320 /usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libCCexcept.so.1

And an example which will reproduce the problem (assuming you have the right
versions of Sun stuff...)

First create a simple object for a shared lib:

% cat bug.c
int foo()
{
   return 1;
}
% cc -KPIC -c bug.c

Make a shared library using the cc driver

% cc -# -G -o libbug.so.cc bug.o
### Note: NLSPATH =
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/usr/local/pkg/SunONEStudio8/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
###     command line files and options (expanded):
### -G bug.o -o libbug.so.cc
### Note: LD_LIBRARY_PATH = /home/scp/lib
### Note: LD_RUN_PATH = <null>
/usr/ccs/bin/ld /usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/crti.o
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/values-xa.o -o libbug.so.cc -G
bug.o -Y
"P,/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib:/usr/ccs/lib:/usr/lib" -Qy
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/crtn.o

Check and see that binutils likes the file

% /usr/local/pkg/binutils-2.16.1/bin/nm libbug.so.cc
000102e8 b Bbss.bss
...


Now do the same using the CC (C++) driver. First a dryrun to see the ld command,
and then the real command.

% CC -dryrun -G -o libbug.so.CC bug.o
###     command line files and options (expanded):
### -dryrun -G -o libbug.so.CC bug.o -xcode=pic13 
### CC: Note: NLSPATH =
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/usr/local/pkg/SunONEStudio8/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
### CC: Note: LD_LIBRARY_PATH = /home/scp/lib
### CC: Note: LD_RUN_PATH     = (null)
### CC: Note: LD_OPTIONS = (null)
/usr/ccs/bin/ld
-zld32=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libCCexcept.so.1
-zld64=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/v9/libCCexcept.so.1
-zld32=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libldstab_ws.so
-zld64=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/v9/libldstab_ws.so -dy
-G
-R/usr/local/pkg/SunONEStudio8/SUNWspro/lib/rw7:/usr/local/pkg/SunONEStudio8/SUNWspro/lib:/opt/SUNWspro/lib:/usr/ccs/lib:/usr/lib
-o libbug.so.CC /usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/crti.o
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/CCrti.o bug.o -Y
P,/usr/local/pkg/SunONEStudio8/SUNWspro/lib/rw7:/usr/local/pkg/SunONEStudio8/SUNWspro/lib:/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/rw7:/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib:/usr/ccs/lib:/usr/lib
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/CCrtn.o
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/crtn.o >&/tmp/ld.24218.0.err
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/bin/c++filt -filt=no%stdlib
</tmp/ld.24218.0.err >>/tmp/c++filt.24218.1.err
rm /tmp/ld.24218.0.err
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/bin/stdlibfilt -stderr
</tmp/c++filt.24218.1.err
rm /tmp/c++filt.24218.1.err

% CC -G -o libbug.so.CC bug.o

And now check that binutils doesn't like this shared object

% /usr/local/pkg/binutils-2.16.1/bin/nm libbug.so.CC
/usr/local/pkg/binutils-2.16.1/bin/nm: libbug.so.CC: File format not recognized


Finally, cut and paste from dryrun above, removing the
-zld32=-S.../libCCexcept.so.1 ...

% /usr/ccs/bin/ld
-zld64=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/v9/libCCexcept.so.1
-zld32=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/libldstab_ws.so
-zld64=-S/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/v9/libldstab_ws.so -dy
-G
-R/usr/local/pkg/SunONEStudio8/SUNWspro/lib/rw7:/usr/local/pkg/SunONEStudio8/SUNWspro/lib:/opt/SUNWspro/lib:/usr/ccs/lib:/usr/lib
-o libbug.so.ld /usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/crti.o
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/CCrti.o bug.o -Y
P,/usr/local/pkg/SunONEStudio8/SUNWspro/lib/rw7:/usr/local/pkg/SunONEStudio8/SUNWspro/lib:/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/rw7:/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib:/usr/ccs/lib:/usr/lib
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/CCrtn.o
/usr/local/pkg/SunONEStudio8/SUNWspro/prod/lib/crtn.o

And this time binutils likes it

% /usr/local/pkg/binutils-2.16.1/bin/nm libbug.so.ld
000106f0 b Bbss.bss
...

I will attach the three different shared objects, in the event that some
maintainer has access to an appropriate Solaris/Sparc system and can determine
what the issue is.

Hope that helps.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=2607

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]