This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, driver] -Wl, passing empty strings to ld
On Fri, 2010-04-16 at 17:46 +0200, Jakub Jelinek wrote:
> I think we should keep -Wl, as is and instead change the linker not
> to give so confusing error message (for empty filename add quotes
> around it or add them around always).
This was my next option to try, but it doesn't directly address the
problem. How is the user supposed to realize that a mis-typed -Wl,
option is responsible for the empty filename? There is no way for the
user to make that connection without help. In an industrial
environment, where you can easily have a linker command over 1KB in
length, this makes finding the problem hard.
But there is a way to solve the problem. The linker could do something
like this when it sees an empty filename on the command line:
khazaddum$ gcc -Wl, --whole-archive tmp.o
/usr/bin/ld: : No such file: No such file or directory
/usr/bin/ld: (empty filename, perhaps a mis-typed -Wl, gcc option)
collect2: ld returned 1 exit status
khazaddum$
The C++ front end does this in a few places, for instance, where it
emits an otherwise confusing error message. I don't know if this is
done anywhere else offhand. Obivously, I'd prefer a gcc solution, but I
could accept this linker solution.
FYI I tried a google search for an exact match on the phrase
"/usr/bin/ld: : No such file: No such file or directory". I found 3 not
counting my gcc-patches thread. One in English got no answer. One in
English got only incorrect answers. And one in Russian got a correct
answer, but it took an hour to find the bug in a fairly trivial command
line. The second one in English in the most interesting one. It has a
link command that is 2381 bytes long, 4 people contributed to the
thread, and none could find the bug over an almost 2 month period. The
question is still unanswered as of today.
http://forums.oracle.com/forums/thread.jspa?threadID=1026800&tstart=0
I took pity on them and registered so I could give them an answer.
Jim
- References:
- [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld
- Re: [PATCH, driver] -Wl, passing empty strings to ld