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 07:25 +0200, Ralf Wildenhues wrote:
> > If you give a command like "ld -o '' tmp.o" then you will get
> >   argv[0]="ld"
> >   argv[1]="-o"
> >   argv[2]="''"
> >   argv[3]="tmp.o"
> 
> No, argv[2] will be "".

Darn, you are right.  I should have tried that.  My mistake.

I still argue that there is a major difference there though.

If I type "ld -o '' tmp.o" and get a cryptic error on the ld output, I
think the average gcc user can figure out what went wrong.  But mistakes
with -Wl lead to cryptic linker errors that can confuse the average
user.

There is also still the problem that -Wa and -Wp are inconsistent with
-Wl, because -Wa and -Wp silently ignore empty strings, while -Wl does
not.

By the way, the original inspiration for the -Wl option was the Sun C
compiler.  I tried the Sun compiler to see what it would do.

dicer:61> cc -Wl, tmp.o
cc: illegal option -Wl,
dicer:62> cc -Wl,, tmp.o
ld: fatal: file : open failed: No such file or directory
dicer:63>

It looks like the Sun C compiler has the same confusing behaviour.  It
tries to open a file with a zero-length name, failed, and then printed
that zero-length file name in the error message which results in a
confusing error message.  This doesn't necessarily make the gcc
behaviour correct, but it also doesn't prove that the gcc behaviour is
wrong.

Anyways, I don't seem to be convincing anyone that anything is wrong
here, so I will just withdraw my patch.

Jim



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