bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/14249] New: Full path to shared object put into binary when it c


From: gerhard.pobinger at kapsch dot net
Subject: [Bug ld/14249] New: Full path to shared object put into binary when it contains no SONAME
Date: Fri, 15 Jun 2012 12:35:02 +0000

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

             Bug #: 14249
           Summary: Full path to shared object put into binary when it
                    contains no SONAME
           Product: binutils
           Version: pre-2.12
            Status: NEW
          Severity: minor
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified


Assume a shared libraries “foo.so” doesn’t contain the linker tag SONAME (nor
DT_SONAME) such that 
~$ readelf -Wa libfoo.so | grep SONAME
is empty

If this is the case, this prevents ld/gcc to correctly link this shared library
in via direct reference to the shared object file (see line (***1***)), e.g.
calling ld via g++:

/usr/bin/c++  -fPIC  -Wno-long-long -Wall -Wextra -O0 -g -g
-Wl,--unresolved-symbols=ignore-in-shared-libs -shared\
-Wl,-soname,libmylib.so -o ../../BIN/libmylib.so\
… object-files … -L/lib/paths … -llibs … /full/path/to/so's ..
/path/to/libfoo.so \ (***1***)
-Wl,rpath, rpath stuff 

This yields a binary with the full path to the so-name for foo, which is only
valid on the build machine:

~$ ldd libmylib.so | grep foo
        /path/to/libfoo.so (0xf53bc000)

If we instead link with “-l” and “-L” flags like this

/usr/bin/c++  -fPIC  -Wno-long-long -Wall -Wextra -O0 -g -g
-Wl,--unresolved-symbols=ignore-in-shared-libs -shared\
-Wl,-soname,libmylib.so -o ../../BIN/libmylib.so\
… object-files … -L/lib/paths … -llibs … /full/path/to/so
-lfoo\ (***2***)
-Wl,rpath, rpath stuff 

the soname is correctly entered in the resulting binary:

~$ ldd libmylib.so | grep foo
        libfoo.so => /path/to/libfoo.so (0xf5462000)

So for the moment we are using the latter approach as a workaround, but for the
future it would be preferable if ld could take only the filename-part (i.e.
"libfoo.so") from the full so-path "/path/to/libfoo.so" and enter this into the
binary "libmylib.so".

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

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