This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix linker on Solaris 10


Hi,

The linker is broken on Solaris 10 because it cannot grok the new flavor of 
shared libraries Sun has implemented.  This is PR ld/1021 on x86 and PR 
ld/1031 on SPARC.

The typical error message is:

../libcrypto.so: undefined reference to `dlclose@SISCD_2.3'
../libcrypto.so: undefined reference to `dlsym@SISCD_2.3'
../libcrypto.so: undefined reference to `dlopen@SISCD_2.3'
../libcrypto.so: undefined reference to `dlerror@SISCD_2.3'

when linking an executable against libcrypto.so, which has been itself linked 
against libdl.  This example comes from OpenSSL but PR 1021 is about Mozilla 
and I've seen the same failures with libjava, so GCC doesn't fully bootstrap.


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 proposed fix is to accept non-hidden absolute symbols that are functions.  
Tested and built on SPARC/Solaris 10, OpenSSL and libjava now build fine.


2005-05-15  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR ld/1021
	PR ld/1031
	* elflink.c (elf_link_add_object_symbols): Also append the version
	name to non-hidden absolute symbols that are functions.


-- 
Eric Botcazou
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	15 Jul 2005 21:59:12 -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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]