https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123504

--- Comment #8 from Peter Damianov <peter0x44 at disroot dot org> ---
Then the problem is the --output-format=coff
Normally, windres would emit a "Microsoft Visual C binary resource file", but
you are overriding it not to.
So, effectively, the file extension no longer matches what the file actually
is.

This is why I call it "Abuse".
With the patch, if you removed --output-format=coff then it would emit a Visual
C resource file, and the driver would handle it "correctly". But of course,
that wouldn't work on an older gcc. And if you wanted that, you could now just
pass the .rc directly to the driver.

> Then the compiler driver needs to look at the file format of the input file, 
> in order to determine whether to invoke windres or not?

Sure. But there's no precedent for that and gcc is not doing it in any other
place, from what I can tell. The driver has no mechanism to inspect file
contents, it relies purely on extensions. Doing this would be nasty hacks.
I think it would be more appropriate for windres itself to check the format,
and maybe make invoking it on a COFF a no-op, instead of an error. But it
doesn't do that.

If instead, you chose to emit a .o (as you *SHOULD*), the driver wouldn't try
to invoke windres on it, and there would be no problem. And there would also be
no need to try to force windres to emit a coff with an extra flag either.

Reply via email to