This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, driver] -Wl, passing empty strings to ld
On 04/15/2010 09:44 AM, Jim Wilson wrote:
> What if an ld option makes sense with an empty argument, e.g. -Wl,-h, or
> -Wl,-l, ? It's a borderline case, I know, and I suppose you can do
> -Xlinker '', but it seems like an arbitrary limitation for an option
> that does pass-through by definition.
The xgcc driver is constructing an argv array, and one of the entries in
the argv array is pointing at a zero-length string. There is no way to
type such a thing on a shell command line. You can certainly type
something like '' which would be a 2 character string as an argument,
I don't follow, it would be a 0 character string in argv. '' or "" is
exactly how you put a zero-length string on the command-line.
but you can't type nothing in the middle of a command line and expect it
to be interpreted as an argument to ld.
That's just how the shell works. You can pass s/abc// or s,abc,, to sed
or vi and it does exactly what you'd think, I don't see why gcc's
-W[alp],arg1,arg2,...,argN options should be different.