public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
@ 2001-01-11  8:12 Richard Stallman
  2001-01-11  8:35 ` Alexandre Oliva
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2001-01-11  8:12 UTC (permalink / raw)
  To: gcc

Would it be feasible to make gcc understand the linker -R argument for
GNU/Linux?  It looks like that would be useful.

------- Start of forwarded message -------
To: Dave Love <d.love@dl.ac.uk>
cc: bug-gnu-emacs@gnu.org
Subject: Re: -Xlinker and LDFLAGS
In-Reply-To: Your message of "11 Jan 2001 00:16:10 GMT."
             <rzqofxfj645.fsf@djlvig.dl.ac.uk> 
From: Greg Hudson <ghudson@MIT.EDU>
Sender: bug-gnu-emacs-admin@gnu.org
X-BeenThere: bug-gnu-emacs@gnu.org
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: < mailto:bug-gnu-emacs-request@gnu.org?subject=help >
List-Post: < mailto:bug-gnu-emacs@gnu.org >
List-Subscribe: < http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs >,
	< mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe >
List-Id: Bug reports for GNU Emacs,
	the Swiss army knife of text editors <bug-gnu-emacs.gnu.org>
	< mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe >
List-Archive: < http://mail.gnu.org/pipermail/bug-gnu-emacs/ >
Date: Wed, 10 Jan 2001 19:24:55 -0500
Content-Type: text
Content-Length: 755

>> This means that emacs has to be treated differently from other
>> packages; for instance, you can't use an LDFLAGS value such as
>> -Wl,-R/thing/to/add/to/run/path.

> Why do you need the -Wl in practice?

	egyptian-gods% rpm -q redhat-release
	redhat-release-6.2-1
	egyptian-gods% touch foo.c
	egyptian-gods% cc -c foo.c
	egyptian-gods% cc -R/tmp foo.o
	cc: unrecognized option `-R/tmp'
	egyptian-gods% cc -v
	Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
	gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

(gcc 2.95 19990728 also doesn't seem to understand -R.)

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs
------- End of forwarded message -------

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11  8:12 [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS] Richard Stallman
@ 2001-01-11  8:35 ` Alexandre Oliva
  2001-01-11  9:36   ` Joe Buck
                     ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Alexandre Oliva @ 2001-01-11  8:35 UTC (permalink / raw)
  To: rms; +Cc: gcc

On Jan 11, 2001, Richard Stallman <rms@gnu.org> wrote:

> Would it be feasible to make gcc understand the linker -R argument for
> GNU/Linux?  It looks like that would be useful.

We've gone over this issue in one of the GCC mailing lists.

GCC only accepts -R on Solaris to be compatible with Sun's C Compiler.
Supporting -R on GNU/Linux too might give people the impression that
-R is a portable switch in GCC, and then, they might start asking why
-R doesn't work on other platforms.

The answer is simple: -R is not a compiler switch, it's a linker
switch on Solaris, that Sun's C Compiler used to pass through to the
linker, GCC does similarly on Solaris for compatibility, and GNU ld
accepts for compatibility with Solaris' linker.  The GNU ld switch is
-rpath.  Other linkers have different switches that convey the same
meaning, or require environment variables to be set to convey that
meaning, or take switches such as -L to implicitly have the same
meaning as -R.

The point is that, spelled -R or -rpath, it's a switch to the linker,
and the syntax to pass a switch to the linker in GCC is -Wl, or
-Xlinker.  Accepting -R in GCC would give people a false sense of
portability.

This is my opinion on this subject.  Others' may differ.

-- 
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] 15+ messages in thread

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11  8:35 ` Alexandre Oliva
@ 2001-01-11  9:36   ` Joe Buck
  2001-01-11  9:54     ` Alexandre Oliva
  2001-01-12 11:19   ` Richard Stallman
  2001-01-12 11:19   ` Richard Stallman
  2 siblings, 1 reply; 15+ messages in thread
From: Joe Buck @ 2001-01-11  9:36 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: rms, gcc

> 
> On Jan 11, 2001, Richard Stallman <rms@gnu.org> wrote:
> 
> > Would it be feasible to make gcc understand the linker -R argument for
> > GNU/Linux?  It looks like that would be useful.
> 
> We've gone over this issue in one of the GCC mailing lists.
> 
> GCC only accepts -R on Solaris to be compatible with Sun's C Compiler.
> Supporting -R on GNU/Linux too might give people the impression that
> -R is a portable switch in GCC, and then, they might start asking why
> -R doesn't work on other platforms.

The problem, though, is that GNU ld made a different decision: it accepts
-R on GNU/Linux explicitly for compatibility with Solaris ld; since the
ELF switch, almost every aspect of linking on GNU/Linux was copied from
Solaris.  What's the use of that decision if GCC dissents from it?  Are we
all on the same team or not?

And maybe -R *should* work on any platform where the linker supports
the -R switch.



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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11  9:36   ` Joe Buck
@ 2001-01-11  9:54     ` Alexandre Oliva
  2001-01-11 10:07       ` Joe Buck
  0 siblings, 1 reply; 15+ messages in thread
From: Alexandre Oliva @ 2001-01-11  9:54 UTC (permalink / raw)
  To: Joe Buck; +Cc: rms, gcc

On Jan 11, 2001, Joe Buck <jbuck@racerx.synopsys.com> wrote:

> And maybe -R *should* work on any platform where the linker supports
> the -R switch.

This would probably make matters even worse.  GNU ld accepts -R as an
alias to -R on all platforms it supports.  But that doesn't mean the
native linker does.  So, GCC's accepting -R would depend on whether
it's configured to use GNU ld or the native linker.  Doesn't appeal to
me.

-- 
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] 15+ messages in thread

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11  9:54     ` Alexandre Oliva
@ 2001-01-11 10:07       ` Joe Buck
  2001-01-11 21:42         ` Phil Edwards
  0 siblings, 1 reply; 15+ messages in thread
From: Joe Buck @ 2001-01-11 10:07 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: rms, gcc

> On Jan 11, 2001, Joe Buck <jbuck@racerx.synopsys.com> wrote:
> 
> > And maybe -R *should* work on any platform where the linker supports
> > the -R switch.
> 
> This would probably make matters even worse.  GNU ld accepts -R as an
> alias to -R on all platforms it supports.  But that doesn't mean the
> native linker does.  So, GCC's accepting -R would depend on whether
> it's configured to use GNU ld or the native linker.  Doesn't appeal to
> me.

Fine, only support -R where we know that either GNU ld is always used,
or the native linker supports -R.


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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11 10:07       ` Joe Buck
@ 2001-01-11 21:42         ` Phil Edwards
  2001-01-11 22:47           ` Fergus Henderson
  0 siblings, 1 reply; 15+ messages in thread
From: Phil Edwards @ 2001-01-11 21:42 UTC (permalink / raw)
  To: Joe Buck; +Cc: Alexandre Oliva, rms, gcc

On Thu, Jan 11, 2001 at 10:06:38AM -0800, Joe Buck wrote:
> > On Jan 11, 2001, Joe Buck <jbuck@racerx.synopsys.com> wrote:
> > 
> > > And maybe -R *should* work on any platform where the linker supports
> > > the -R switch.
> > 
> > This would probably make matters even worse.  GNU ld accepts -R as an
> > alias to -R on all platforms it supports.  But that doesn't mean the
> > native linker does.  So, GCC's accepting -R would depend on whether
> > it's configured to use GNU ld or the native linker.  Doesn't appeal to
> > me.
> 
> Fine, only support -R where we know that either GNU ld is always used,
> or the native linker supports -R.

We would either need to track all those platforms, or automatically
detect them.

Deteting them a la Autoconf would be interesting (in the Chinese curse
sense); just because a given platform's linker accepts -R doesn't mean
that the linker is doing what we expect.

As an example, GNU ld itself assigns completely different means to -Rfoo
depending on whether foo is a directory or not.


I'll reiterate my suggestion that on platforms where we don't already
pass -R, we should recognize and warn about it.  Something like "-R is way
nonportable, maybe you want to start using -Wl".  I was the one who started
the last round of discussion on this topic, but I've become convinced that
silently supporing -R may not be best for users in the long run.


Phil

-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11 21:42         ` Phil Edwards
@ 2001-01-11 22:47           ` Fergus Henderson
  2001-01-11 22:51             ` Phil Edwards
  0 siblings, 1 reply; 15+ messages in thread
From: Fergus Henderson @ 2001-01-11 22:47 UTC (permalink / raw)
  To: gcc

On 12-Jan-2001, Phil Edwards <pedwards@disaster.jaj.com> wrote:
> 
> I'll reiterate my suggestion that on platforms where we don't already
> pass -R, we should recognize and warn about it.  Something like "-R is way
> nonportable, maybe you want to start using -Wl".

I don't see how that helps, since `-Wl' is no more portable than `-R',
isn't it?

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11 22:47           ` Fergus Henderson
@ 2001-01-11 22:51             ` Phil Edwards
  2001-01-12  5:18               ` Fergus Henderson
  0 siblings, 1 reply; 15+ messages in thread
From: Phil Edwards @ 2001-01-11 22:51 UTC (permalink / raw)
  To: Fergus Henderson; +Cc: gcc

On Fri, Jan 12, 2001 at 05:47:03PM +1100, Fergus Henderson wrote:
> On 12-Jan-2001, Phil Edwards <pedwards@disaster.jaj.com> wrote:
> > 
> > I'll reiterate my suggestion that on platforms where we don't already
> > pass -R, we should recognize and warn about it.  Something like "-R is way
> > nonportable, maybe you want to start using -Wl".
> 
> I don't see how that helps, since `-Wl' is no more portable than `-R',
> isn't it?

No, -Wl is understood by GCC itself.  It's used to pass arbitrary
options down to the linker.  In this case, '-Wl,-Rdirectory' or '-Wl,-R
-Wl,directory' depending on whether a space is required, etc.

I should not have left that out in my previous message, sorry.


Phil

-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11 22:51             ` Phil Edwards
@ 2001-01-12  5:18               ` Fergus Henderson
  2001-01-12  8:54                 ` Phil Edwards
  0 siblings, 1 reply; 15+ messages in thread
From: Fergus Henderson @ 2001-01-12  5:18 UTC (permalink / raw)
  To: gcc

On 12-Jan-2001, Phil Edwards <pedwards@disaster.jaj.com> wrote:
> On Fri, Jan 12, 2001 at 05:47:03PM +1100, Fergus Henderson wrote:
> > On 12-Jan-2001, Phil Edwards <pedwards@disaster.jaj.com> wrote:
> > > 
> > > I'll reiterate my suggestion that on platforms where we don't already
> > > pass -R, we should recognize and warn about it.  Something like "-R is way
> > > nonportable, maybe you want to start using -Wl".
> > 
> > I don't see how that helps, since `-Wl' is no more portable than `-R',
> > isn't it?
> 
> No, -Wl is understood by GCC itself.

Sorry, what I meant was this:

	I don't see how that helps, since `-Wl,-R' is no more portable than `-R',
	isn't it?                          ^^^^^^

(I thought this would be understood from the context, but clearly not.)

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-12  5:18               ` Fergus Henderson
@ 2001-01-12  8:54                 ` Phil Edwards
  0 siblings, 0 replies; 15+ messages in thread
From: Phil Edwards @ 2001-01-12  8:54 UTC (permalink / raw)
  To: Fergus Henderson; +Cc: gcc

On Sat, Jan 13, 2001 at 12:18:29AM +1100, Fergus Henderson wrote:
> On 12-Jan-2001, Phil Edwards <pedwards@disaster.jaj.com> wrote:
> 
> Sorry, what I meant was this:
> 
> 	I don't see how that helps, since `-Wl,-R' is no more portable than `-R',
> 	isn't it?                          ^^^^^^
> 
> (I thought this would be understood from the context, but clearly not.)

Oh, I see what you mean now.

I think it helps just because of this:  certain platforms will have an
-R-accepting driver and others won't.  Reminding the user of a portable
linker hook will let them use -Wl,-R on those platforms where it's accepted
and -Wl,-whatever on the others.  But many people may not even know that -Wl
exists.  If we accept and pass -R on the platforms which use it, users might
believe that's the correct thing to do, and come to expect us to translate
-R into the correct linker option for those linkers which don't use it.

That was somewhat rambling; I'm probably not making a lot of sense.  :-)

Alexandre and others have convinced me that my first proposal was not
the best solution, but I feel that the current state still needs *some*
kind of fixing.


Phil
(I don't know how we ended up with both "-Xlinker" and "-Wl".  Why 'W'?)

-- 
pedwards at disaster dot jaj dot com  |  pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools.  Fools are protected by more capable fools.

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11  8:35 ` Alexandre Oliva
  2001-01-11  9:36   ` Joe Buck
@ 2001-01-12 11:19   ` Richard Stallman
  2001-01-12 11:45     ` David Edelsohn
  2001-01-12 12:36     ` Richard Earnshaw
  2001-01-12 11:19   ` Richard Stallman
  2 siblings, 2 replies; 15+ messages in thread
From: Richard Stallman @ 2001-01-12 11:19 UTC (permalink / raw)
  To: aoliva; +Cc: gcc

    The answer is simple: -R is not a compiler switch, it's a linker
    switch on Solaris, that Sun's C Compiler used to pass through to the
    linker, GCC does similarly on Solaris for compatibility, and GNU ld
    accepts for compatibility with Solaris' linker.

It is normal for C compilers to pass linker switches through.
The Unix C compiler did that in the mid 80s.

      The GNU ld switch is -rpath.

(It ought to be --rpath, right?  Is it --rpath, or is it just -rpath?)

--rpath might be a reasonable name for this option.  But is there a
good reason NOT to use -R on all systems?  After all, the other
options in GNU ld were mostly inspired by various other BSD-ish
systems.  If we support the functionality of -R, why not call it -R?
And why not have GCC forward it through?

Are there systems where -R in the native linker has some other
meaning instead?

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-11  8:35 ` Alexandre Oliva
  2001-01-11  9:36   ` Joe Buck
  2001-01-12 11:19   ` Richard Stallman
@ 2001-01-12 11:19   ` Richard Stallman
  2001-01-12 12:01     ` Joe Buck
  2 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2001-01-12 11:19 UTC (permalink / raw)
  To: aoliva; +Cc: gcc

    The point is that, spelled -R or -rpath, it's a switch to the linker,
    and the syntax to pass a switch to the linker in GCC is -Wl, or
    -Xlinker.  Accepting -R in GCC would give people a false sense of
    portability.

People might get a false sense of portability either way.  If GCC
passes through -R, they might also convince their linker maintainer to
implement -R.

If we adopt -R as a standard GCC feature, we could implement it in
different ways on different systems, so that it gets the same result
on all.  Users would probably consider that a step forward.

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-12 11:19   ` Richard Stallman
@ 2001-01-12 11:45     ` David Edelsohn
  2001-01-12 12:36     ` Richard Earnshaw
  1 sibling, 0 replies; 15+ messages in thread
From: David Edelsohn @ 2001-01-12 11:45 UTC (permalink / raw)
  To: rms; +Cc: aoliva, gcc

>>>>> Richard Stallman writes:

Richard> Are there systems where -R in the native linker has some other
Richard> meaning instead?

	Yes, most definitely.  -R/-rpath is specific to a type of
dynamic linking behavior.

David

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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-12 11:19   ` Richard Stallman
@ 2001-01-12 12:01     ` Joe Buck
  0 siblings, 0 replies; 15+ messages in thread
From: Joe Buck @ 2001-01-12 12:01 UTC (permalink / raw)
  To: rms; +Cc: aoliva, gcc

RMS writes:

> If we adopt -R as a standard GCC feature, we could implement it in
> different ways on different systems, so that it gets the same result
> on all.  Users would probably consider that a step forward.

I like the idea of this, but some target platforms lack the needed concept
(of a wired-in search patch for shared libraries).  Still, I'd at least
like it to be present where it works and is trivial, as on GNU/Linux.


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

* Re: [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS]
  2001-01-12 11:19   ` Richard Stallman
  2001-01-12 11:45     ` David Edelsohn
@ 2001-01-12 12:36     ` Richard Earnshaw
  1 sibling, 0 replies; 15+ messages in thread
From: Richard Earnshaw @ 2001-01-12 12:36 UTC (permalink / raw)
  To: rms; +Cc: rearnsha

rms@gnu.org said:
> Are there systems where -R in the native linker has some other meaning
> instead?


I wouldn't know about a different meaning, but there are certainly systems 
that don't support the concept at all, a.out versions of NetBSD being one.


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

end of thread, other threads:[~2001-01-12 12:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-11  8:12 [ghudson@MIT.EDU: Re: -Xlinker and LDFLAGS] Richard Stallman
2001-01-11  8:35 ` Alexandre Oliva
2001-01-11  9:36   ` Joe Buck
2001-01-11  9:54     ` Alexandre Oliva
2001-01-11 10:07       ` Joe Buck
2001-01-11 21:42         ` Phil Edwards
2001-01-11 22:47           ` Fergus Henderson
2001-01-11 22:51             ` Phil Edwards
2001-01-12  5:18               ` Fergus Henderson
2001-01-12  8:54                 ` Phil Edwards
2001-01-12 11:19   ` Richard Stallman
2001-01-12 11:45     ` David Edelsohn
2001-01-12 12:36     ` Richard Earnshaw
2001-01-12 11:19   ` Richard Stallman
2001-01-12 12:01     ` Joe Buck

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