This is the mail archive of the gcc-patches@gcc.gnu.org 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]
Other format: [Raw text]

Re: [PATCH, driver] -Wl, passing empty strings to ld


On Fri, 2010-04-16 at 10:01 +0200, Paolo Bonzini wrote:
> The difference is that -Wa and -Wp are processed by do_spec_1, while -Wl 
> isn't.

Yes, I mentioned this in the original message.

> This patch would fix that, but who knows what might break.

Why not fix it the other way, i.e. make -Wl ignore empty strings for
consistency with -Wa and -Wp?  This is simpler, and would solve my
original problem in that a simple typo "-Wl, --whole-archive" instead of
"-Wl,--whole-archive" would no longer give a confusing error message
from the linker.

Or alternatively, perhaps you would accept a simpler patch that only
disallows "-Wl," but still allows other combinations like
"-Wl,,--whole-archive" and "-Wl,--whole-archive,"?  This would appear to
be consistent with the Sun C compiler behaviour, and also solves the
original problem, and also still allows one to use the option to pass
empty strings to the linker if one should really want to do that.

Or another alternative, perhaps we can change -Wl, to accept spaces
before the argument?  Some gcc options accept an argument with or
without a space.  For instance both "-L/usr/lib" and "-L /usr/lib" are
accepted as valid.  It would be silly to insist that "-L" should be
interpreted as an attempt to pass an empty string to the linker, as no
one would ever want it to mean that.  This is why I find it so very hard
to accept the claim that "-Wl," is an attempt to pass an empty string to
the linker.  It is inconsistent with how gcc handles every other option.
Either it takes an arg or it doesn't.  We shouldn't be constructing
empty string arguments out of nowhere just because the user failed to
realize that -Wl, does not allow a space before the argument.

Jim



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