Summary: | linker errors on Solaris 10 (symbol versioning?) | ||
---|---|---|---|
Product: | binutils | Reporter: | Niki W. Waibel <niki.waibel> |
Component: | ld | Assignee: | unassigned |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bug-binutils, ebotcazou, funtoos |
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | sparc-sun-solaris2.10 | Target: | sparc-sun-solaris2.10 |
Build: | sparc-sun-solaris2.10 | Last reconfirmed: | |
Bug Depends on: | |||
Bug Blocks: | 1021 |
Description
Niki W. Waibel
2005-06-22 14:14:34 UTC
libtool seems to add -lc to creating shared libraries. change: # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=yes to: # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=no and see if this makes any difference. remember you must recreate libcrypto.so after this. hmmm, libtool is *not* used when building openssl. oops, sorry. a similar problem was resolved with this fix. I hit this error in openssl with gcc 4 and binutils 2.16.1: ../libcrypto.so: undefined reference to `dlopen@SUNW_0.7' ../libcrypto.so: undefined reference to `dlclose@SUNW_0.7' ../libcrypto.so: undefined reference to `dlsym@SUNW_0.7' ../libcrypto.so: undefined reference to `dlerror@SUNW_0.7' And the workaround I mentioned about libtool actually works. just remove '-lc -ldl' from link line of libcrypto.so and other links work fine after that. it seems that -shared and -lc (or -ldl) are not playing nice together on solaris, only on 10+ though. solaris 9 has no such problem. Why does linking shared library require -lc on link line? also, I should mention that same openssl package compiles fine on solaris 10 with gcc using /usr/ccs/ tools instead of binutils. original gcc 3.4.3 on the install was built with /usr/ccs/bin/ld. okay. if -lc and -ldl is removed from the openssl makefile then openssl compiles fine. I can reproduce with GCC 4.0.1 and Binutils 2.16.1. Output of nm on /usr/lib/libdl.so.1: Solaris 10: [Index] Value Size Type Bind Other Shndx Name [34] | 0| 0|FUNC |GLOB |0 |ABS |dlclose [32] | 0| 0|FUNC |GLOB |0 |ABS |dldump [27] | 0| 0|FUNC |GLOB |0 |ABS |dlerror [35] | 0| 0|FUNC |GLOB |0 |ABS |dlinfo [28] | 0| 0|FUNC |GLOB |0 |ABS |dlmopen [18] | 0| 0|FUNC |GLOB |0 |ABS |dlopen [20] | 0| 0|FUNC |GLOB |0 |ABS |dlsym Solaris 7, 8 and 9: [Index] Value Size Type Bind Other Shndx Name [40] | 1828| 8|FUNC |WEAK |0 |7 |dlclose [38] | 1860| 8|FUNC |WEAK |0 |7 |dldump [32] | 1836| 8|FUNC |WEAK |0 |7 |dlerror [41] | 1796| 8|FUNC |WEAK |0 |7 |dlinfo [33] | 1804| 8|FUNC |WEAK |0 |7 |dlmopen [23] | 1812| 8|FUNC |WEAK |0 |7 |dlopen [25] | 1820| 8|FUNC |WEAK |0 |7 |dlsym Output of nm on /usr/lib/libc.so.1: Solaris 10: [6053] | 0| 0|FUNC |GLOB |0 |ABS |dlclose [7698] | 0| 0|FUNC |GLOB |0 |ABS |dldump [8132] | 0| 0|FUNC |GLOB |0 |ABS |dlerror [7686] | 0| 0|FUNC |GLOB |0 |ABS |dlinfo [6797] | 0| 0|FUNC |GLOB |0 |ABS |dlmopen [6142] | 0| 0|FUNC |GLOB |0 |ABS |dlopen [8293] | 0| 0|FUNC |GLOB |0 |ABS |dlsym Solaris 7, 8 and 9: [empty] Output of "man dlopen": Solaris 10: NAME dlopen, dlmopen - gain access to an executable object file SYNOPSIS #include <dlfcn.h> #include <link.h> void * dlopen(const char *pathname, int mode); void * dlmopen(Lmid_t lmid, const char *pathname, int mode); Solaris 7, 8 and 9: NAME dlopen, dlmopen - gain access to an executable object file SYNOPSIS cc [ flag... ] file... -ldl [ library... ] #include <dlfcn.h> #include <link.h> void * dlopen(const char *pathname, int mode); void * dlmopen(Lmid_t lmid, const char *pathname, int mode) What has changed in libdl between Solaris 9 and Solaris 10 is that the stubs for dlopen, dlclose, etc present on Solaris 9: poog% /opt/build/eric/local/bin/objdump -T /usr/lib/libdl.so.1 /usr/lib/libdl.so.1: file format elf32-sparc DYNAMIC SYMBOL TABLE: 00000714 w DF .text 00000008 SISCD_2.3 dlopen 0000072c g DF .text 00000008 SUNWprivate_1.1 _dlerror 0000071c w DF .text 00000008 SISCD_2.3 dlsym 000001b8 g DO .dynamic 00000000 Base _DYNAMIC 00000744 g DF .text 00000008 SUNWprivate_1.1 _dldump 0000070c g DF .text 00000008 SUNWprivate_1.1 _dlmopen 00000000 g DO *ABS* 00000000 SUNW_1.1 SUNW_1.1 00000704 g DF .text 00000008 SUNWprivate_1.1 _dlinfo 00000000 g DO *ABS* 00000000 SUNW_1.2 SUNW_1.2 0000072c w DF .text 00000008 SISCD_2.3 dlerror 0000070c w DF .text 00000008 SUNW_1.1 dlmopen 00000000 g DO *ABS* 00000000 SUNW_1.3 SUNW_1.3 00000000 g DO *ABS* 00000000 SUNW_0.7 SUNW_0.7 00000000 g DO *ABS* 00000000 SUNW_1.4 SUNW_1.4 00000000 g DO *ABS* 00000000 SUNW_0.8 SUNW_0.8 00000744 w DF .text 00000008 SUNW_1.1 dldump 00000734 g DF .text 00000008 SUNWprivate_1.1 _dladdr 00000724 w DF .text 00000008 SISCD_2.3 dlclose 00000704 w DF .text 00000008 SUNW_1.1 dlinfo 00000000 g DO *ABS* 00000000 SUNWprivate_1.1 SUNWprivate_1.1 0000073c g DF .text 00000008 SUNWprivate_1.1 _dladdr1 00000000 g DO *ABS* 00000000 Base _edata 00000724 g DF .text 00000008 SUNWprivate_1.1 _dlclose 00000714 g DF .text 00000008 SUNWprivate_1.1 _dlopen 00000766 g DO .bss 00000000 Base _etext 0000074c g DF .text 00000008 SUNWprivate_1.1 _ld_concurrency 00000754 g DF .text 00000008 SUNWprivate_1.1 _ld_libc 00000000 g DO *ABS* 00000000 SISCD_2.3 SISCD_2.3 00000734 w DF .text 00000008 SUNW_0.8 dladdr 0000076c g DO .bss 00000000 Base _end 0000071c g DF .text 00000008 SUNWprivate_1.1 _dlsym 0000073c w DF .text 00000008 SUNW_1.4 dladdr1 00000000 g DO *ABS* 00000000 Base _PROCEDURE_LINKAGE_TABLE_ have been turned into mere dummy symbols on Solaris 10: hikaru% /opt/build/eric/local/bin/objdump -T /usr/lib/libdl.so.1 /usr/lib/libdl.so.1: file format elf32-sparc DYNAMIC SYMBOL TABLE: 00000000 g DF *ABS* 00000000 SISCD_2.3 dlopen 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dlerror 00000000 g DF *ABS* 00000000 SISCD_2.3 dlsym 00000094 g DO .dynamic 00000000 Base _DYNAMIC 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dldump 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dlmopen 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dlinfo 00000000 g DO *ABS* 00000000 SUNW_1.1 SUNW_1.1 00000000 g DO *ABS* 00000000 SUNW_1.2 SUNW_1.2 00000000 g DF *ABS* 00000000 SISCD_2.3 dlerror 00000000 g DF *ABS* 00000000 SUNW_1.1 dlmopen 00000000 g DO *ABS* 00000000 SUNW_1.3 SUNW_1.3 00000000 g DO *ABS* 00000000 SUNW_1.4 SUNW_1.4 00000000 g DO *ABS* 00000000 SUNW_0.7 SUNW_0.7 00000000 g DF *ABS* 00000000 SUNW_1.1 dldump 00000000 g DO *ABS* 00000000 SUNW_0.8 SUNW_0.8 00000000 g DF *ABS* 00000000 SISCD_2.3 dlclose 00000000 g DF *ABS* 00000000 SUNW_1.1 dlinfo 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dladdr 00000000 g DO *ABS* 00000000 SUNWprivate_1.1 SUNWprivate_1.1 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dladdr1 00000000 g DO *ABS* 00000000 Base _edata 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dlopen 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dlclose 000006c3 g DO .bss 00000000 Base _etext 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _ld_concurrency 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _ld_libc 00000000 g DO *ABS* 00000000 SISCD_2.3 SISCD_2.3 000006c3 g DO .bss 00000000 Base _end 00000000 g DF *ABS* 00000000 SUNW_0.8 dladdr 00000000 g DF *ABS* 00000000 SUNWprivate_1.1 _dlsym 00000000 g DF *ABS* 00000000 SUNW_1.4 dladdr1 00000000 g DO *ABS* 00000000 Base _PROCEDURE_LINKAGE_TABLE_ The key here is the section of the symbols: it is .text on Solaris 9 and the absolute section on Solaris 10. This runs afoul of the following FIXME in elf_link_add_object_symbols: /* If this is a hidden symbol, or if it is not version 1, we append the version name to the symbol name. However, we do not modify a non-hidden absolute symbol, because it might be the version symbol itself. FIXME: What if it isn't? */ if ((iver.vs_vers & VERSYM_HIDDEN) != 0 || (vernum > 1 && ! bfd_is_abs_section (sec))) The following patch lets me build OpenSSL on SPARC/Solaris 10: Index: elflink.c =================================================================== RCS file: /cvs/src/src/bfd/elflink.c,v retrieving revision 1.136.2.3 diff -u -p -r1.136.2.3 elflink.c --- elflink.c 27 Apr 2005 16:47:24 -0000 1.136.2.3 +++ elflink.c 14 Jul 2005 16:21:05 -0000 @@ -3683,11 +3683,12 @@ elf_link_add_object_symbols (bfd *abfd, /* If this is a hidden symbol, or if it is not version 1, we append the version name to the symbol name. - However, we do not modify a non-hidden absolute - symbol, because it might be the version symbol - itself. FIXME: What if it isn't? */ + However, we do not modify a non-hidden absolute symbol + if it is not a function, because it might be the version + symbol itself. FIXME: What if it isn't? */ if ((iver.vs_vers & VERSYM_HIDDEN) != 0 - || (vernum > 1 && ! bfd_is_abs_section (sec))) + || (vernum > 1 && (! bfd_is_abs_section (sec) + || ELF_ST_TYPE (isym->st_info) == STT_FUNC))) { const char *verstr; size_t namelen, verlen, newlen; > The following patch lets me build OpenSSL on SPARC/Solaris 10:
And libjava from GCC 4.0.x, both 32-bit and 64-bit, testsuite results are OK.
I'm going to submit it and try to have it installed on the 2.16 branch too.
i'd like to prove that Eric Botcazou patch on binutils-2.16.91.0.1 on solaris10 (5.10 Generic_118822-02) works very well. i can compile openssl using gcc-4.0.1 and the mentioned gnu binutils!!! eric, thank you!!! http://sourceware.org/ml/binutils-cvs/2005-07/msg00121.html http://sourceware.org/ml/binutils-cvs/2005-07/msg00122.html *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla. |