This is the mail archive of the binutils@sourceware.org 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]

ld -m elf_i386 on x86 Solaris


Hi,

Using the elf_i386 emulation on x86 solaris, when linking to a shared 
library it doesn't search the DT_RPATH, etc. for other shared libaries 
the linked library depends on.

I've put a suggested fix below, which uses targ_extra_libpath=elf_i386 
instead of targ_extra_emuls=elf_i386:
Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.188
diff -u -r1.188 configure.tgt
--- ld/configure.tgt	24 May 2006 07:36:11 -0000	1.188
+++ ld/configure.tgt	19 Jun 2006 21:44:39 -0000
@@ -162,11 +162,12 @@
 			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
 i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386 ;;
 i[3-7]86-*-solaris2*)	targ_emul=elf_i386_ldso
-                        targ_extra_emuls="elf_i386 elf_x86_64"
+                        targ_extra_libpath=elf_i386
+                        targ_extra_emuls=elf_x86_64
                         ;;
 i[3-7]86-*-unixware)	targ_emul=elf_i386 ;;
 i[3-7]86-*-solaris*)	targ_emul=elf_i386_ldso
-                        targ_extra_emuls="elf_i386"
+                        targ_extra_libpath=elf_i386
                         ;;
 i[3-7]86-*-netbsdelf* | \
 i[3-7]86-*-netbsd*-gnu* | \

I came across the problem using gcc on Solaris 10, e.g.:
$ echo "int main() { return 0; }" > foo.c
$ gcc foo.c -lsocket
/usr/local/bin/ld: warning: libnsl.so.1, needed 
by /usr/lib/libsocket.so, not found (try using -rpath or -rpath-link)

64-bit linking also isn't working, but that's something separate. 32-bit 
linking does work, so if gcc is configured with --disable-multilib then 
--with-gnu-ld will work.

The problem shows up with gcc because it invokes ld as 'ld -m elf_i386'. 
See gcc/config/i386/sol2-10.h in the gcc sources:
#define TARGET_LD_EMULATION "%{m64:-m elf_x86_64}%{!m64:-m elf_i386} "
Should it be using the default emulation anyway?

And should the same apply the 64-bit linking? If elf_i386_ldso is needed 
will an elf_x86_64_ldso be needed too?

Regards,
Mike


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