bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/14852] New: gnu ld can't use a library linked via solaris ld, if


From: pashev.igor at gmail dot com
Subject: [Bug ld/14852] New: gnu ld can't use a library linked via solaris ld, if that library uses a library linked with GNU ld
Date: Fri, 16 Nov 2012 10:10:22 +0000

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

             Bug #: 14852
           Summary: gnu ld can't use a library linked via solaris ld, if
                    that library uses a library linked with GNU ld
           Product: binutils
           Version: 2.22
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: address@hidden
        ReportedBy: address@hidden
    Classification: Unclassified


Created attachment 6741
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6741
test suite and binaries

Suppose we have a library [number 1] linked with GNU ld, say libz.
Then we use this library (libz) to create other library [number 2]
(e. g. libzfs), but using illumos/solaris link-editor.
Then if we try to link libzfs to some application using
GNU ld we will fail. Error will look like:

"undefined reference to address@hidden'"

This is because symbol `compress' in libz has no version assosiated, and thus
is of "base version" which is the soname. Default and hardcoded behavior of
solaris link-editor is to import base versions into outputfile (I quess it is
like the option --default-imported-symver for GNU ld).

I'd rather think it's solaris linker bug (a kind of), but it looks more tricky,
because solaris linker can use library number 2 without any issues.

I'm attaching an archive with tests and precompiled libraries.

Note, that GNU ld I use is patched to support alternative linker, and
ld-gnu-to-sun is a wrapper for solaris ld.

Build log:

# LANG=C make -k
gcc -shared -fpic -Wl,-h -Wl,libfoo-gnu.so -o libfoo-gnu.so
-Wl,--version-script,foo.map libfoo.c
gcc -shared -fpic -Wl,-h -Wl,libbar-gnu.so -o libbar-gnu.so -L. -lfoo-gnu -R
\$ORIGIN libbar.c
gcc -o app-gnu-libbar-gnu main.c -L. -lbar-gnu -Wl,-rpath,. -R \$ORIGIN
LD_ALTEXEC=ld-gnu-to-sun gcc -shared -fpic -Wl,-h -Wl,libbar-sun.so -o
libbar-sun.so -L. -lfoo-gnu -R \$ORIGIN libbar.c
+ exec /usr/bin/sunld -G -dy -z text -R $ORIGIN -Qy -o libbar-sun.so
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crti.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/values-Xa.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/crtbegin.o -L.
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../../lib -L/lib/x86_64-illumos
-L/lib/../lib -L/usr/lib/x86_64-illumos -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../.. -h libbar-sun.so -lfoo-gnu
/var/tmp//ccgwa4JF.o -lgcc_s -lc -lgcc_s
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/crtend.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crtn.o
ld: warning: global symbol '_END_' has non-global binding:
        (file ./libfoo-gnu.so value=LOCL);
ld: warning: global symbol '_START_' has non-global binding:
        (file ./libfoo-gnu.so value=LOCL);
gcc -o app-gnu-libbar-sun main.c -L. -lbar-sun -Wl,-rpath,. -R \$ORIGIN
./libbar-sun.so: undefined reference to address@hidden'
collect2: error: ld returned 1 exit status
make: *** [app-gnu-libbar-sun] Error 1
LD_ALTEXEC=ld-gnu-to-sun gcc -o app-sun-libbar-sun main.c -L. -lbar-sun
-Wl,-rpath,. -R \$ORIGIN
+ exec /usr/bin/sunld -R $ORIGIN -Qy -o app-sun-libbar-sun
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crt1.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crti.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/values-Xa.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/crtbegin.o -L.
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../../lib -L/lib/x86_64-illumos
-L/lib/../lib -L/usr/lib/x86_64-illumos -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../.. /var/tmp//ccvHaqLF.o
-lbar-sun -rpath . -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/crtend.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crtn.o
ld: warning: global symbol '_END_' has non-global binding:
        (file ./libfoo-gnu.so value=LOCL);
ld: warning: global symbol '_START_' has non-global binding:
        (file ./libfoo-gnu.so value=LOCL);
LD_ALTEXEC=ld-gnu-to-sun gcc -o app-sun-libbar-gnu main.c -L. -lbar-gnu
-Wl,-rpath,. -R \$ORIGIN
+ exec /usr/bin/sunld -R $ORIGIN -Qy -o app-sun-libbar-gnu
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crt1.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crti.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/values-Xa.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/crtbegin.o -L.
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../../lib -L/lib/x86_64-illumos
-L/lib/../lib -L/usr/lib/x86_64-illumos -L/usr/lib/../lib
-L/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../.. /var/tmp//ccINaaMF.o
-lbar-gnu -rpath . -lgcc -lgcc_eh -lc -lgcc -lgcc_eh
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/crtend.o
/usr/lib/gcc/x86_64-pc-solaris2.11/4.7/../../../x86_64-illumos/crtn.o
ld: warning: global symbol '_END_' has non-global binding:
        (file ./libbar-gnu.so value=LOCL);
ld: warning: global symbol '_START_' has non-global binding:
        (file ./libbar-gnu.so value=LOCL);
ld: warning: global symbol '_END_' has non-global binding:
        (file ./libfoo-gnu.so value=LOCL);
ld: warning: global symbol '_START_' has non-global binding:
        (file ./libfoo-gnu.so value=LOCL);
make: Target `all' not remade because of errors.

-- 
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]