public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Wrong dynamic-linker used on Solaris 7/x86
@ 2001-05-20  7:44 Alexandre Oliva
  2001-05-20  8:14 ` Philip Blundell
  0 siblings, 1 reply; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20  7:44 UTC (permalink / raw)
  To: binutils, gcc

I've just stumbled across a problem on Solaris 7/x86.  A program
wouldn't run with a NULL environment if linked with GNU ld, but it
would work fine if linked with Solaris ld.  Simple demonstration:

#include <unistd.h>
int main(int argc, char *argv[]) {
  static char *env[] = { NULL };
  execle (argv[0], argv[0], NULL, env);
}

The program that got the empty environment would crash when ld.so.1
dereferenced an invalid address.  I've discussed the problem with a
friend I've got at Sun, and he pointed out that truss shouldn't have
mentioned ld.so.1 at all; it should have been handled by the kernel.

Indeed, when the program was linked with Solaris ld, truss didn't
mention ld.so.1.  Only with GNU ld was ld.so.1 explicitly mentioned.

It turned out that the problem is that GNU ld uses /usr/lib/libc.so.1
as the default --dynamic-linker on ELF x86 targets.  For Solaris/x86,
the correct choice would have been /usr/lib/ld.so.1.

Now I'm at a loss on how to address the problem.  I suppose it would
be reasonable to arrange for GCC to pass the dynamic linker name to
the linker.

One problem is that Solaris ld uses the `-I' switch to specify the
dynamic linker, whereas GNU ld doesn't accept this flag; it requires
`--dynamic-linker' instead.  I could introduce a different
configuration for GCC --with-gnu-ld that would use --dynamic-linker by
default, but this seems messy.  However, it would get GCC to work
correctly even with older versions of GNU ld.  Another option is to
implement -I as an alias to --dynamic-linker on Solaris; this would
allow gcc to use the same LINK_SPEC, but would require a fixed GNU ld.
The plus of this option is that one could switch between GNU ld and
Solaris ld with -B switches, as it is possible today.


The other alternative is to modify BFD so that it defaults to the same
dynamic linker that Solaris ld does.  The problem is that all (most?) 
ELF x86 systems use elf32-i386.c, that defines ELF_DYNAMIC_INTERPRETER
to "/usr/lib/libc.so.1".  If I change this, I might be breaking other
targets.  If I introduce an alternate BFD vec that sets
ELF_DYNAMIC_INTERPRETER appropriately for Solaris/x86, it will be
mostly indistinguishable from the current one, so automatic emulation
detection won't work.


Suggestions?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20  7:44 Wrong dynamic-linker used on Solaris 7/x86 Alexandre Oliva
@ 2001-05-20  8:14 ` Philip Blundell
  2001-05-20  8:32   ` Alexandre Oliva
  2001-05-20 10:25   ` Mark Mitchell
  0 siblings, 2 replies; 28+ messages in thread
From: Philip Blundell @ 2001-05-20  8:14 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils, gcc

>correctly even with older versions of GNU ld.  Another option is to
>implement -I as an alias to --dynamic-linker on Solaris; this would
>allow gcc to use the same LINK_SPEC, but would require a fixed GNU ld.
>The plus of this option is that one could switch between GNU ld and
>Solaris ld with -B switches, as it is possible today.

I think this is the way to go.

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20  8:14 ` Philip Blundell
@ 2001-05-20  8:32   ` Alexandre Oliva
  2001-05-20  8:41     ` Philip Blundell
  2001-05-20 10:25   ` Mark Mitchell
  1 sibling, 1 reply; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20  8:32 UTC (permalink / raw)
  To: Philip Blundell; +Cc: binutils, gcc

On May 20, 2001, Philip Blundell <philb@gnu.org> wrote:

>> correctly even with older versions of GNU ld.  Another option is to
>> implement -I as an alias to --dynamic-linker on Solaris; this would
>> allow gcc to use the same LINK_SPEC, but would require a fixed GNU ld.
>> The plus of this option is that one could switch between GNU ld and
>> Solaris ld with -B switches, as it is possible today.

> I think this is the way to go.

Even though it would cause GCC 3.0 to not work with GNU binutils 2.11?

BTW, I've got more news on this issue.  Sun does support
/usr/lib/libc.so.1 as the interpreter; the fact that it crashes is
indeed caused by a bug in their code.  I'm helping my friend at Sun
correct it.  So, it might be that we don't need to fix anything, after
all.  The problem would only show up with a NULL environment, so it's
probably not something one would encounter in real life.  And then,
hopefully Sun will release a patch to address this problem soon, so
whoever encounters the problem might as well just upgrade, or work
around the problem by telling GNU ld to use /usr/lib/ld.so.1 as the
dynamic linker, or by using Sun ld.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20  8:32   ` Alexandre Oliva
@ 2001-05-20  8:41     ` Philip Blundell
  2001-05-20  9:06       ` Alexandre Oliva
  0 siblings, 1 reply; 28+ messages in thread
From: Philip Blundell @ 2001-05-20  8:41 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: binutils, gcc

>Even though it would cause GCC 3.0 to not work with GNU binutils 2.11?

Yeah: we can always make a 2.11.1 release of binutils just prior to GCC 3.0 
coming out, if that would smooth the path at all.  (It looks like we'll 
probably end up doing so at about that time in any case, actually.)

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20  8:41     ` Philip Blundell
@ 2001-05-20  9:06       ` Alexandre Oliva
  0 siblings, 0 replies; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20  9:06 UTC (permalink / raw)
  To: Philip Blundell; +Cc: binutils, gcc

On May 20, 2001, Philip Blundell <philb@gnu.org> wrote:

>> Even though it would cause GCC 3.0 to not work with GNU binutils 2.11?
> Yeah: we can always make a 2.11.1 release of binutils just prior to GCC 3.0 
> coming out, if that would smooth the path at all.  (It looks like we'll 
> probably end up doing so at about that time in any case, actually.)

Besides, we can probably add a test to disable the use of -I if we
detect an old-enough GNU ld at configure time.  It's not like the
current behavior is totally broken, it's generally only slightly less
efficient, disregarding this corner case that is hopefully going to be
fixed in Solaris libc soon.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20  8:14 ` Philip Blundell
  2001-05-20  8:32   ` Alexandre Oliva
@ 2001-05-20 10:25   ` Mark Mitchell
  2001-05-20 10:52     ` Alexandre Oliva
  1 sibling, 1 reply; 28+ messages in thread
From: Mark Mitchell @ 2001-05-20 10:25 UTC (permalink / raw)
  To: philb; +Cc: aoliva, binutils, gcc

>>>>> "Philip" == Philip Blundell <philb@gnu.org> writes:

    >> correctly even with older versions of GNU ld.  Another option
    >> is to implement -I as an alias to --dynamic-linker on Solaris;
    >> this would allow gcc to use the same LINK_SPEC, but would
    >> require a fixed GNU ld.  The plus of this option is that one
    >> could switch between GNU ld and Solaris ld with -B switches, as
    >> it is possible today.

    Philip> I think this is the way to go.

Me too -- but I also think that you should fix GNU ld to work like the
Solaris linker by default.  I'm not sure why automatic detection
wouldn't work -- doesn't Solaris set an OS flag in the ELF header?

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 10:25   ` Mark Mitchell
@ 2001-05-20 10:52     ` Alexandre Oliva
  2001-05-20 10:57       ` Mark Mitchell
  2001-05-20 11:10       ` Philip Blundell
  0 siblings, 2 replies; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20 10:52 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: philb, binutils, gcc

On May 20, 2001, Mark Mitchell <mark@codesourcery.com> wrote:

>>>>>> "Philip" == Philip Blundell <philb@gnu.org> writes:
>>> correctly even with older versions of GNU ld.  Another option
>>> is to implement -I as an alias to --dynamic-linker on Solaris;
>>> this would allow gcc to use the same LINK_SPEC, but would
>>> require a fixed GNU ld.  The plus of this option is that one
>>> could switch between GNU ld and Solaris ld with -B switches, as
>>> it is possible today.

Philip> I think this is the way to go.

> Me too -- but I also think that you should fix GNU ld to work like the
> Solaris linker by default.  I'm not sure why automatic detection
> wouldn't work -- doesn't Solaris set an OS flag in the ELF header?

Dunno.  I had thought at first of creating a new BFD vector, such as
elf32-i386-sol2.c, but now I realize this wouldn't necessary, as long
as there is some way to tell, in elf_i386_size_dynamic_sections(),
whether ELFOSABI_SOLARIS is set somewhere, assuming this would be the
way to detect we're linking for Solaris.  If that's the case, where
would this `somewhere' be?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 10:52     ` Alexandre Oliva
@ 2001-05-20 10:57       ` Mark Mitchell
  2001-05-20 11:03         ` Alexandre Oliva
  2001-05-20 11:10       ` Philip Blundell
  1 sibling, 1 reply; 28+ messages in thread
From: Mark Mitchell @ 2001-05-20 10:57 UTC (permalink / raw)
  To: aoliva; +Cc: philb, binutils, gcc

>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:

    Alexandre> be the way to detect we're linking for Solaris.  If
    Alexandre> that's the case, where would this `somewhere' be?

You got me -- I'm out of my binutils depth.  But, if you can find the
ELF header for the output BFD you could look there; I think stuff
normally gets copied from the input BFDs.

Sorry,

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 10:57       ` Mark Mitchell
@ 2001-05-20 11:03         ` Alexandre Oliva
  2001-05-20 11:08           ` Mark Mitchell
  0 siblings, 1 reply; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20 11:03 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: philb, binutils, gcc

On May 20, 2001, Mark Mitchell <mark@codesourcery.com> wrote:

>>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:
Alexandre> be the way to detect we're linking for Solaris.  If
Alexandre> that's the case, where would this `somewhere' be?

> You got me -- I'm out of my binutils depth.  But, if you can find the
> ELF header for the output BFD you could look there; I think stuff
> normally gets copied from the input BFDs.

What I just can't find is any reference at all to ELFOSABI_SOLARIS.
Apparently, this is only #defined in include/elf, and used nowhere,
not leaving much hope for finding this in the output BFD, or even in
input BFDs :-(

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 11:03         ` Alexandre Oliva
@ 2001-05-20 11:08           ` Mark Mitchell
  2001-05-20 11:28             ` Alexandre Oliva
  2001-05-20 12:01             ` Ulrich Drepper
  0 siblings, 2 replies; 28+ messages in thread
From: Mark Mitchell @ 2001-05-20 11:08 UTC (permalink / raw)
  To: aoliva; +Cc: philb, binutils, gcc

>>>>> "Alexandre" == Alexandre Oliva <aoliva@redhat.com> writes:

    Alexandre> What I just can't find is any reference at all to
    Alexandre> ELFOSABI_SOLARIS.  Apparently, this is only #defined in
    Alexandre> include/elf, and used nowhere, not leaving much hope
    Alexandre> for finding this in the output BFD, or even in input
    Alexandre> BFDs :-(

Oh, yeah, not unless the Sun compiler made the .o's you're linking.

Well, now I guess you have *two* binutils bugs to fix. :-)

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 10:52     ` Alexandre Oliva
  2001-05-20 10:57       ` Mark Mitchell
@ 2001-05-20 11:10       ` Philip Blundell
  2001-05-20 12:52         ` Alexandre Oliva
  1 sibling, 1 reply; 28+ messages in thread
From: Philip Blundell @ 2001-05-20 11:10 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Mark Mitchell, binutils, gcc

>Dunno.  I had thought at first of creating a new BFD vector, such as
>elf32-i386-sol2.c, but now I realize this wouldn't necessary, as long
>as there is some way to tell, in elf_i386_size_dynamic_sections(),
>whether ELFOSABI_SOLARIS is set somewhere, assuming this would be the
>way to detect we're linking for Solaris.  If that's the case, where
>would this `somewhere' be?

I have a feeling that you will find that ELFOSABI_SOLARIS isn't actually used,
and Solaris just declares itself as "System V" (ie ELFOSABI_NONE).  If it were, 
I guess elf_elfheader(output_bfd)->e_ident would be the place to go looking for 
it.

You might do better to create a new linker emulation, have it override the 
contents of the .interp section, and make that the default for Solaris.  That 
way the hackery is localised inside ld, rather than involving BFD itself.

(Personally I don't think I'd bother: there are several other targets where GNU 
ld will get the interpreter location wrong if it's left to its own devices, 
and GCC has to include an appropriate -dynamic-linker option in the specs 
file.)

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 11:08           ` Mark Mitchell
@ 2001-05-20 11:28             ` Alexandre Oliva
  2001-05-20 12:01             ` Ulrich Drepper
  1 sibling, 0 replies; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20 11:28 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: philb, binutils, gcc

On May 20, 2001, Mark Mitchell <mark@codesourcery.com> wrote:


> Well, now I guess you have *two* binutils bugs to fix. :-)

Me?!? :-D

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 11:08           ` Mark Mitchell
  2001-05-20 11:28             ` Alexandre Oliva
@ 2001-05-20 12:01             ` Ulrich Drepper
  1 sibling, 0 replies; 28+ messages in thread
From: Ulrich Drepper @ 2001-05-20 12:01 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: aoliva, philb, binutils, gcc

Mark Mitchell <mark@codesourcery.com> writes:

>     Alexandre> What I just can't find is any reference at all to
>     Alexandre> ELFOSABI_SOLARIS.  Apparently, this is only #defined in
>     Alexandre> include/elf, and used nowhere, not leaving much hope
>     Alexandre> for finding this in the output BFD, or even in input
>     Alexandre> BFDs :-(
> 
> Oh, yeah, not unless the Sun compiler made the .o's you're linking.
> 
> Well, now I guess you have *two* binutils bugs to fix. :-)

No.  The ELFOSABI_SOLARIS is not supposed to be defined unless there
is something Solaris specific about the ELF format the file is using.
This is not the case.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 11:10       ` Philip Blundell
@ 2001-05-20 12:52         ` Alexandre Oliva
  2001-05-20 14:35           ` Philip Blundell
  2001-05-20 16:44           ` H . J . Lu
  0 siblings, 2 replies; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20 12:52 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Mark Mitchell, binutils, gcc

On May 20, 2001, Philip Blundell <philb@gnu.org> wrote:

> You might do better to create a new linker emulation, have it
> override the contents of the .interp section, and make that the
> default for Solaris.  That way the hackery is localised inside ld,
> rather than involving BFD itself.

I like this.  It's the least pervasive change of all proposed so far.

Here's the patch that implements it.  Tested on
GNU/Linux-x-Solaris/x86.  Ok to install?

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 12:52         ` Alexandre Oliva
@ 2001-05-20 14:35           ` Philip Blundell
  2001-05-20 14:49             ` Alexandre Oliva
  2001-05-22  4:58             ` Alexandre Oliva
  2001-05-20 16:44           ` H . J . Lu
  1 sibling, 2 replies; 28+ messages in thread
From: Philip Blundell @ 2001-05-20 14:35 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Mark Mitchell, binutils, gcc

>Here's the patch that implements it.  Tested on
>GNU/Linux-x-Solaris/x86.  Ok to install?

Looks reasonable to me.  Do you also want to make a patch to add `-I' as an 
alias for `--dynamic-linker'? 

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 14:35           ` Philip Blundell
@ 2001-05-20 14:49             ` Alexandre Oliva
  2001-05-22  4:58             ` Alexandre Oliva
  1 sibling, 0 replies; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-20 14:49 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Mark Mitchell, binutils, gcc

On May 20, 2001, Philip Blundell <philb@gnu.org> wrote:

>> Here's the patch that implements it.  Tested on
>> GNU/Linux-x-Solaris/x86.  Ok to install?

> Looks reasonable to me.  Do you also want to make a patch to add `-I' as an 
> alias for `--dynamic-linker'? 

I was hoping we could get on without it...

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 12:52         ` Alexandre Oliva
  2001-05-20 14:35           ` Philip Blundell
@ 2001-05-20 16:44           ` H . J . Lu
  2001-05-20 21:22             ` Mark Mitchell
  2001-05-20 23:50             ` Philip Blundell
  1 sibling, 2 replies; 28+ messages in thread
From: H . J . Lu @ 2001-05-20 16:44 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Philip Blundell, Mark Mitchell, binutils, gcc

On Sun, May 20, 2001 at 04:52:28PM -0300, Alexandre Oliva wrote:
> On May 20, 2001, Philip Blundell <philb@gnu.org> wrote:
> 
> > You might do better to create a new linker emulation, have it
> > override the contents of the .interp section, and make that the
> > default for Solaris.  That way the hackery is localised inside ld,
> > rather than involving BFD itself.
> 
> I like this.  It's the least pervasive change of all proposed so far.
> 
> Here's the patch that implements it.  Tested on
> GNU/Linux-x-Solaris/x86.  Ok to install?
> 

Personally, I don't like it. When we moved Linux from a.out to ELF, I
didn't write an ELF linker script for Linux. To me, there should be
only one ELF linker for ia32. I prefer to pass -dynamic-linker to ld.

When we fixed gcc/binutils a few years ago, "gcc -v" no longer worked
under Linux due to the assembler change. We fixed gcc and patched the
specs file for the existing gcc. What is wrong with that? I doubt there
are more Solaris/x86 using gcc today than Linux/x86 5 years ago.


H.J.

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 16:44           ` H . J . Lu
@ 2001-05-20 21:22             ` Mark Mitchell
  2001-05-21  9:04               ` H . J . Lu
  2001-05-20 23:50             ` Philip Blundell
  1 sibling, 1 reply; 28+ messages in thread
From: Mark Mitchell @ 2001-05-20 21:22 UTC (permalink / raw)
  To: hjl; +Cc: aoliva, philb, binutils, gcc

>>>>> "H" == H J Lu <hjl@lucon.org> writes:

    H> Personally, I don't like it. When we moved Linux from a.out to
    H> ELF, I didn't write an ELF linker script for Linux. To me,
    H> there should be only one ELF linker for ia32. I prefer to pass
    H> -dynamic-linker to ld.

What if someone wants to use the linker directly by itself?

If there is a "right" dynamic linker for Solaris, then the linker
should use it by default.  Otherwise, we're just making our users work
harder.

That doesn't mean we should use -dynamic-linker in GCC, too.  Doing
that makes us work with old versions of GNU ld, which is certainly
good.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 16:44           ` H . J . Lu
  2001-05-20 21:22             ` Mark Mitchell
@ 2001-05-20 23:50             ` Philip Blundell
  2001-05-21  8:54               ` H . J . Lu
  1 sibling, 1 reply; 28+ messages in thread
From: Philip Blundell @ 2001-05-20 23:50 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Alexandre Oliva, Mark Mitchell, binutils, gcc

>When we fixed gcc/binutils a few years ago, "gcc -v" no longer worked
>under Linux due to the assembler change. We fixed gcc and patched the
>specs file for the existing gcc. What is wrong with that? I doubt there
>are more Solaris/x86 using gcc today than Linux/x86 5 years ago.

Well, it's a slightly different situation: Solaris has a vendor-provided 
linker, and if we want GNU ld to be a drop-in replacement for that linker it 
has to use the same defaults.  Especially as Solaris ld doesn't apparently 
accept the `--dynamic-linker' option, and GNU ld doesn't currently accept -I.

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 23:50             ` Philip Blundell
@ 2001-05-21  8:54               ` H . J . Lu
  2001-05-22  3:23                 ` Alexandre Oliva
  2001-05-22 10:08                 ` Matt Schalit
  0 siblings, 2 replies; 28+ messages in thread
From: H . J . Lu @ 2001-05-21  8:54 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Alexandre Oliva, Mark Mitchell, binutils, gcc

On Mon, May 21, 2001 at 07:50:05AM +0100, Philip Blundell wrote:
> >When we fixed gcc/binutils a few years ago, "gcc -v" no longer worked
> >under Linux due to the assembler change. We fixed gcc and patched the
> >specs file for the existing gcc. What is wrong with that? I doubt there
> >are more Solaris/x86 using gcc today than Linux/x86 5 years ago.
> 
> Well, it's a slightly different situation: Solaris has a vendor-provided 
> linker, and if we want GNU ld to be a drop-in replacement for that linker it 
> has to use the same defaults.  Especially as Solaris ld doesn't apparently 
> accept the `--dynamic-linker' option, and GNU ld doesn't currently accept -I.

Then add -I to ld. We had the similar problem with as when we moved
to ELF. This is in gcc 2.7.2.3:

#undef ASM_SPEC
#define ASM_SPEC \
  "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"

This is in gcc today:

#define ASM_SPEC \
  "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"

People who use my new Linux binutils and gcc 2.7.2.3 have to patch
the gcc source or the specs file. Otherwise, "gcc -V" won't work.


H.J.

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 21:22             ` Mark Mitchell
@ 2001-05-21  9:04               ` H . J . Lu
  0 siblings, 0 replies; 28+ messages in thread
From: H . J . Lu @ 2001-05-21  9:04 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: aoliva, philb, binutils, gcc

On Sun, May 20, 2001 at 09:22:43PM -0700, Mark Mitchell wrote:
> >>>>> "H" == H J Lu <hjl@lucon.org> writes:
> 
>     H> Personally, I don't like it. When we moved Linux from a.out to
>     H> ELF, I didn't write an ELF linker script for Linux. To me,
>     H> there should be only one ELF linker for ia32. I prefer to pass
>     H> -dynamic-linker to ld.
> 
> What if someone wants to use the linker directly by itself?

As a binutils developer, I will not take any bug reports where ld is
called directly to generate executables/DSO. I will tell him/her that
DON'T DO IT.


H.J.

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-21  8:54               ` H . J . Lu
@ 2001-05-22  3:23                 ` Alexandre Oliva
  2001-05-22 10:08                 ` Matt Schalit
  1 sibling, 0 replies; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-22  3:23 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Philip Blundell, Mark Mitchell, binutils, gcc

On May 21, 2001, "H . J . Lu" <hjl@lucon.org> wrote:

> On Mon, May 21, 2001 at 07:50:05AM +0100, Philip Blundell wrote:
>> >When we fixed gcc/binutils a few years ago, "gcc -v" no longer worked
>> >under Linux due to the assembler change. We fixed gcc and patched the
>> >specs file for the existing gcc. What is wrong with that? I doubt there
>> >are more Solaris/x86 using gcc today than Linux/x86 5 years ago.
>> 
>> Well, it's a slightly different situation: Solaris has a vendor-provided 
>> linker, and if we want GNU ld to be a drop-in replacement for that linker it 
>> has to use the same defaults.  Especially as Solaris ld doesn't apparently 
>> accept the `--dynamic-linker' option, and GNU ld doesn't currently accept -I.

> Then add -I to ld. We had the similar problem with as when we moved
> to ELF.

This still won't make GNU ld a drop-in replacement for Solaris ld.
And it won't help GCC work better with older versions of GNU ld that
don't support it yet.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-20 14:35           ` Philip Blundell
  2001-05-20 14:49             ` Alexandre Oliva
@ 2001-05-22  4:58             ` Alexandre Oliva
  2001-05-22  5:20               ` Philip Blundell
  1 sibling, 1 reply; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-22  4:58 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Mark Mitchell, binutils, gcc

On May 20, 2001, Philip Blundell <philb@gnu.org> wrote:

>> Here's the patch that implements it.  Tested on
>> GNU/Linux-x-Solaris/x86.  Ok to install?

> Looks reasonable to me.

So, we have one vote for and one against it.  Who can make a decision?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-22  4:58             ` Alexandre Oliva
@ 2001-05-22  5:20               ` Philip Blundell
  2001-05-22  7:00                 ` Nick Clifton
  0 siblings, 1 reply; 28+ messages in thread
From: Philip Blundell @ 2001-05-22  5:20 UTC (permalink / raw)
  To: Alexandre Oliva, nickc; +Cc: Mark Mitchell, binutils, gcc

>So, we have one vote for and one against it.  Who can make a decision?

Nick's the binutils head honcho; I guess he ought to decide.

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-22  5:20               ` Philip Blundell
@ 2001-05-22  7:00                 ` Nick Clifton
  2001-05-22  7:15                   ` Alexandre Oliva
  0 siblings, 1 reply; 28+ messages in thread
From: Nick Clifton @ 2001-05-22  7:00 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Alexandre Oliva, Mark Mitchell, binutils, gcc

Hi Phil,

> >So, we have one vote for and one against it.  Who can make a
> >decision? 
> 
> Nick's the binutils head honcho; I guess he ought to decide.

Who's also been asleep at the wheel for the last week.  Or at least it 
feel that way.  Sorry, guys, it is end-of-quarter hell over here at
the moment.

Anyway - my opinion is that we ought to do both things, ie support -I
as an alias for --dynamic-linker and set the default dynamic linker
for Solaris environments to be ld.so.1.  That way GNU ld can be used
as a drop in replacement for Solaris ld, and I think that this is a
worthy goal.

So here is Alexandre's patch supplemented with a patch to lexsup.c to
add -I.  I have applied this patch.

Cheers
        Nick


2001-05-22  Alexandre Oliva  <aoliva@redhat.com>

	* emulparams/elf_i386_ldso.sh: New, copied from elf_i386.sh.
	(ELF_INTERPRETER_NAME): Define it.
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Use
	it.
	* configure.tgt (targ_emul, targ_extra_emuls)
	[i[3456]86-*-solaris2*, i[3456]86-*-solaris*]: Use elf_i386_ldso
	as primary, elf_i386 as extra.
	* Makefile.am (ALL_EMULATIONS): Added eelf_i386_ldso.o.
	(eelf_i386_ldso.c): New rule.
	* Makefile.in: Rebuilt.

2001-05-22  Nick Clifton  <nickc@redhat.com>

	* lexsup.c (ld_options):  Allow -I to be an alias for
	--dynamic-linker.  This is for Solaris compatibility.
	* ld.texinfo: Document that -I can be used.
	* ld.1: Regenerate.

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-22  7:00                 ` Nick Clifton
@ 2001-05-22  7:15                   ` Alexandre Oliva
  2001-05-22  7:19                     ` Philip Blundell
  0 siblings, 1 reply; 28+ messages in thread
From: Alexandre Oliva @ 2001-05-22  7:15 UTC (permalink / raw)
  To: Nick Clifton; +Cc: Philip Blundell, Mark Mitchell, binutils, gcc

On May 22, 2001, Nick Clifton <nickc@cambridge.redhat.com> wrote:

> So here is Alexandre's patch supplemented with a patch to lexsup.c to
> add -I.  I have applied this patch.

Perhaps this should go into the 2.11 branch too?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-22  7:15                   ` Alexandre Oliva
@ 2001-05-22  7:19                     ` Philip Blundell
  0 siblings, 0 replies; 28+ messages in thread
From: Philip Blundell @ 2001-05-22  7:19 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: Nick Clifton, Mark Mitchell, binutils, gcc

>Perhaps this should go into the 2.11 branch too?

Yep.  Do you want to copy it over?

p.


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

* Re: Wrong dynamic-linker used on Solaris 7/x86
  2001-05-21  8:54               ` H . J . Lu
  2001-05-22  3:23                 ` Alexandre Oliva
@ 2001-05-22 10:08                 ` Matt Schalit
  1 sibling, 0 replies; 28+ messages in thread
From: Matt Schalit @ 2001-05-22 10:08 UTC (permalink / raw)
  To: H . J . Lu; +Cc: Philip Blundell, Alexandre Oliva, Mark Mitchell, binutils, gcc

"H . J . Lu" wrote:
> 
> On Mon, May 21, 2001 at 07:50:05AM +0100, Philip Blundell wrote:
> > >When we fixed gcc/binutils a few years ago, "gcc -v" no longer worked
> > >under Linux due to the assembler change. We fixed gcc and patched the
> > >specs file for the existing gcc. What is wrong with that? I doubt there
> > >are more Solaris/x86 using gcc today than Linux/x86 5 years ago.
> >
> > Well, it's a slightly different situation: Solaris has a vendor-provided
> > linker, and if we want GNU ld to be a drop-in replacement for that linker it
> > has to use the same defaults.  Especially as Solaris ld doesn't apparently
> > accept the `--dynamic-linker' option, and GNU ld doesn't currently accept -I.
> 
> Then add -I to ld. We had the similar problem with as when we moved
> to ELF. This is in gcc 2.7.2.3:
> 
> #undef ASM_SPEC
> #define ASM_SPEC \
>   "%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
> 
> This is in gcc today:
> 
> #define ASM_SPEC \
>   "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}"
> 
> People who use my new Linux binutils and gcc 2.7.2.3 have to patch
> the gcc source or the specs file. Otherwise, "gcc -V" won't work.
> 
> H.J.




Sir:

Please excuse my jumping in.

But this is my exact problem with SCO's native as and building 
every gcc from 2.95.2 thru 3.1 on UnixWare 7.1.1.

If I try to build gcc using ./configure --with-gnu-as --with-as=/usr/local/bin/as
the gmake bootstrap fails with

     /usr/local/bin/as: Unknown option: -Qy.


Please, how do I fix this?  It's been a thorn for months now.
Thank you!
Matthew

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

end of thread, other threads:[~2001-05-22 10:08 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-20  7:44 Wrong dynamic-linker used on Solaris 7/x86 Alexandre Oliva
2001-05-20  8:14 ` Philip Blundell
2001-05-20  8:32   ` Alexandre Oliva
2001-05-20  8:41     ` Philip Blundell
2001-05-20  9:06       ` Alexandre Oliva
2001-05-20 10:25   ` Mark Mitchell
2001-05-20 10:52     ` Alexandre Oliva
2001-05-20 10:57       ` Mark Mitchell
2001-05-20 11:03         ` Alexandre Oliva
2001-05-20 11:08           ` Mark Mitchell
2001-05-20 11:28             ` Alexandre Oliva
2001-05-20 12:01             ` Ulrich Drepper
2001-05-20 11:10       ` Philip Blundell
2001-05-20 12:52         ` Alexandre Oliva
2001-05-20 14:35           ` Philip Blundell
2001-05-20 14:49             ` Alexandre Oliva
2001-05-22  4:58             ` Alexandre Oliva
2001-05-22  5:20               ` Philip Blundell
2001-05-22  7:00                 ` Nick Clifton
2001-05-22  7:15                   ` Alexandre Oliva
2001-05-22  7:19                     ` Philip Blundell
2001-05-20 16:44           ` H . J . Lu
2001-05-20 21:22             ` Mark Mitchell
2001-05-21  9:04               ` H . J . Lu
2001-05-20 23:50             ` Philip Blundell
2001-05-21  8:54               ` H . J . Lu
2001-05-22  3:23                 ` Alexandre Oliva
2001-05-22 10:08                 ` Matt Schalit

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).