This is the mail archive of the mailing list for the GCC project.

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

Re: Is this supposed to work, or am I loopy?

Hi Guys,

: From Joe:
: What I'm saying is that the difference is gratuitous and is caused
: by the gcc driver.

But it is not gratuitous.  The support (by gcc) for -R under some
OS'es is a convenience but a requirement.  GCC does not gratuitously
decide to not support -R, it actually provides the completely
standard, and workable, -Wl,-R option.  Supporting -R is non-standard,
and is only provided as a nicety to help users who are used to
Solaris compilers that do the translation of -R to -Wl,-R behind their

: On both Solaris and Linux, the linker understands the -R switch and 
: treats it identically.  On Solaris, the gcc driver accepts -R and
: passes it through to the linker.  On Linux, the gcc driver rejects
: -R.  That is, the two OSes would have identical behavior, except
: that for some reason gcc decides to treat them differently.  There
: is no reason for gcc to impose this difference.

Yes there is - there is no standard or requirement that gcc should
pass -R on to the linker.  If you want to pass options on to the
linker you should use -Wl,<option>.  There is no good reason why -R
should be given special consideration over other linker command line
options.  After all if gcc passes -R on to the linker then why doesn't 
it pass -O on to the linker as well ?  [Some linker's do support a -O

: From: Phil:
: Maybe on those platforms where -R doesn't get passed through, we can
: print a more useful message than `unrecognized option'.  After all, it's
: "recognized" on other platforms.

That is not really a good argument.  Just because an option is
recognized on one platform does not mean that it will be recognized on
another platform, nor does it mean that gcc should be aware of all
potential platforms and issue error messages like

  "option 'foo' not recognized on this platform.  Perhaps you should
  be running this program on platform 'bar' instead ?"

:     3)  I feel that we should recognize and warn about the problem
:         rather than passing it through and exacerbating the
:         misunderstanding. 

Do you mean that gcc should never accept -R, even on a Solaris
targeted toolchain ?  I am not a Solaris user so it would not affect
me, but I can imagine that quite a few users would be upset.  Of
course in the long run it would probably help them, since they would
have to change their makefile to use the correct -Wl, mechanism, and
if they ever migrate to other targets these makefile will continue to

: Linux should perhaps be an exception, since the documentation for ld 
: on Linux states that -Rdir is specifically supported for
: compatibility with sparcs.  Right now it really looks like one hand
: has no idea what the other is doing.  :-)

No no, that is the GNU/Linux linker being compatible with the Solaris
linker, not the GNU/Linus gcc being compatible with the Solaris cc.


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