This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: Use of -Wl,-r
On Fri, 10 Jun 2011, Roland McGrath wrote:
> Hmm, ok. I can take it out. The rationale was that gcc documentation does
> not say that -r is an option it groks at all, so it seemed like it might be
> some sort of happenstance that it just passes it through to ld. That is,
> gcc passes unrecognized options through to every pass, to passing -r along
> might just have been from that. But I see now that -r is in fact
> recognized in the link_command spec, even though this is not documented.
The documentation of linker options accepted is rather lacking, but it's
entirely deliberate what's passed down: that's fully controlled by specs,
options are only passed down if the relevant spec says to pass them down
(not simply if unknown) and options are rejected if no spec matches them.
It's unknown *extensions on input files* that cause those inputs just to
be quietly treated as linker inputs, but there's nothing corresponding for
options. GCC 4.6 has stricter option checking, and in 4.7 all options are
known explicitly rather than accepted just because matched by some spec
(for example, an unknown -fsomething option will be rejected by the driver
rather than passed down to cc1 for cc1 to reject, or quietly accepted if
that particular compilation doesn't run cc1). (And -r, along with all the
other options in specs, is now explicitly known to the driver as an
option.)
--
Joseph S. Myers
joseph@codesourcery.com