public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld -m elf_i386 on x86 Solaris
@ 2006-06-20 12:33 Michael Wetherell
  2006-06-23 18:30 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Wetherell @ 2006-06-20 12:33 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ld -m elf_i386 on x86 Solaris
  2006-06-20 12:33 ld -m elf_i386 on x86 Solaris Michael Wetherell
@ 2006-06-23 18:30 ` Daniel Jacobowitz
  2006-06-28  9:16   ` Michael Wetherell
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-06-23 18:30 UTC (permalink / raw)
  To: Michael Wetherell; +Cc: binutils

On Tue, Jun 20, 2006 at 01:23:58PM +0100, Michael Wetherell wrote:
> 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:

You're supposed to set both.  I've checked in a similar fix, thanks.

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

No, if gcc specifies -dynamic-linker (which it probably does) then it
shouldn't matter.

-- 
Daniel Jacobowitz
CodeSourcery

2006-06-23  Daniel Jacobowitz  <dan@codesourcery.com>

	* configure.tgt (i[3-7]86-*-solaris2*, i[3-7]86-*-solaris*): Set
	targ_extra_libpath.

Index: configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.188
diff -u -p -r1.188 configure.tgt
--- configure.tgt	24 May 2006 07:36:11 -0000	1.188
+++ configure.tgt	23 Jun 2006 18:09:57 -0000
@@ -163,10 +163,12 @@ x86_64-*-linux-*)	targ_emul=elf_x86_64
 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=$target_extra_emuls
                         ;;
 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=$target_extra_emuls
                         ;;
 i[3-7]86-*-netbsdelf* | \
 i[3-7]86-*-netbsd*-gnu* | \

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ld -m elf_i386 on x86 Solaris
  2006-06-23 18:30 ` Daniel Jacobowitz
@ 2006-06-28  9:16   ` Michael Wetherell
  2006-06-29  5:50     ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Wetherell @ 2006-06-28  9:16 UTC (permalink / raw)
  To: binutils

On Friday 23 Jun 2006 19:12, Daniel Jacobowitz wrote:
> > I've put a suggested fix below, which uses
> > targ_extra_libpath=elf_i386 instead of targ_extra_emuls=elf_i386:
>
> You're supposed to set both.  I've checked in a similar fix, thanks.

Ok, if that's the convention.

>                          targ_extra_emuls="elf_i386 elf_x86_64"
> +                       targ_extra_libpath=$target_extra_emuls

You have a typo in the name though                ^^

I'm preparing a patch for the 64-bit issues, so I'll include a fix in 
there.

Regards,
Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ld -m elf_i386 on x86 Solaris
  2006-06-28  9:16   ` Michael Wetherell
@ 2006-06-29  5:50     ` Daniel Jacobowitz
  2006-06-29  7:49       ` Michael Wetherell
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-06-29  5:50 UTC (permalink / raw)
  To: binutils

On Wed, Jun 28, 2006 at 09:42:56AM +0100, Michael Wetherell wrote:
> On Friday 23 Jun 2006 19:12, Daniel Jacobowitz wrote:
> > > I've put a suggested fix below, which uses
> > > targ_extra_libpath=elf_i386 instead of targ_extra_emuls=elf_i386:
> >
> > You're supposed to set both.  I've checked in a similar fix, thanks.
> 
> Ok, if that's the convention.

I think it is - everyone else seems to spell it that way.

> >                          targ_extra_emuls="elf_i386 elf_x86_64"
> > +                       targ_extra_libpath=$target_extra_emuls
> 
> You have a typo in the name though                ^^

:-(  Sorry!  I'm glad you noticed.

> I'm preparing a patch for the 64-bit issues, so I'll include a fix in 
> there.

Could you send it separately?  That way it can be reviewed and applied
independently of more complex changes.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ld -m elf_i386 on x86 Solaris
  2006-06-29  5:50     ` Daniel Jacobowitz
@ 2006-06-29  7:49       ` Michael Wetherell
  2006-07-14 15:28         ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Wetherell @ 2006-06-29  7:49 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

On Thursday 29 Jun 2006 03:24, Daniel Jacobowitz wrote:
> Could you send it separately?  That way it can be reviewed and
> applied independently of more complex changes.

ld/ChangeLog
2006-06-28  Michael Wetherell  <mike.wetherell@ntlworld.com>

	* configure.tgt (i[3-7]86-*-solaris2*, i[3-7]86-*-solaris*): Correct
	typo setting targ_extra_libpath.

Thanks,
Mike

[-- Attachment #2: solaris-libpath.diff --]
[-- Type: text/x-diff, Size: 822 bytes --]

Index: ld/configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.189
diff -u -2 -r1.189 configure.tgt
--- ld/configure.tgt	23 Jun 2006 18:11:47 -0000	1.189
+++ ld/configure.tgt	28 Jun 2006 00:42:40 -0000
@@ -164,10 +164,10 @@
 i[3-7]86-*-solaris2*)	targ_emul=elf_i386_ldso
                         targ_extra_emuls="elf_i386 elf_x86_64"
-			targ_extra_libpath=$target_extra_emuls
+			targ_extra_libpath=$targ_extra_emuls
                         ;;
 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=$target_extra_emuls
+			targ_extra_libpath=$targ_extra_emuls
                         ;;
 i[3-7]86-*-netbsdelf* | \

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ld -m elf_i386 on x86 Solaris
  2006-06-29  7:49       ` Michael Wetherell
@ 2006-07-14 15:28         ` Daniel Jacobowitz
  2006-07-14 15:54           ` Michael Wetherell
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2006-07-14 15:28 UTC (permalink / raw)
  To: Michael Wetherell; +Cc: binutils

On Thu, Jun 29, 2006 at 07:39:12AM +0100, Michael Wetherell wrote:
> On Thursday 29 Jun 2006 03:24, Daniel Jacobowitz wrote:
> > Could you send it separately?  That way it can be reviewed and
> > applied independently of more complex changes.
> 
> ld/ChangeLog
> 2006-06-28  Michael Wetherell  <mike.wetherell@ntlworld.com>
> 
> 	* configure.tgt (i[3-7]86-*-solaris2*, i[3-7]86-*-solaris*): Correct
> 	typo setting targ_extra_libpath.

Sorry about the delay, I checked this in.

-- 
Daniel Jacobowitz
CodeSourcery

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ld -m elf_i386 on x86 Solaris
  2006-07-14 15:28         ` Daniel Jacobowitz
@ 2006-07-14 15:54           ` Michael Wetherell
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Wetherell @ 2006-07-14 15:54 UTC (permalink / raw)
  To: binutils

On Friday 14 Jul 2006 16:28, Daniel Jacobowitz wrote:
> Sorry about the delay, I checked this in.

No problem.
Thanks,
Mike

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-07-14 15:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-20 12:33 ld -m elf_i386 on x86 Solaris Michael Wetherell
2006-06-23 18:30 ` Daniel Jacobowitz
2006-06-28  9:16   ` Michael Wetherell
2006-06-29  5:50     ` Daniel Jacobowitz
2006-06-29  7:49       ` Michael Wetherell
2006-07-14 15:28         ` Daniel Jacobowitz
2006-07-14 15:54           ` Michael Wetherell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).