Open PiotrSikora opened 1 year ago
Problem is here:
Args are passed to clang directly, but -target
is not translated from zig style to clang style.
That logic cannot be naively deleted however, because the rest of the compiler is not designed to read from stdin, and will fail like this:
$ stage4/bin/zig cc -target x86-linux-gnu -dM -E - </dev/null
LLD Link... ld.lld: error: cannot open -: No such file or directory
The proper fix is to indeed delete this logic, but then edit Compilation.zig to handle this case specially and forward -
and stdin to clang, but with the zig target and CPU feature flags. This will have the effect of fixing some other subtle bugs - anywhere zig has different CPU target defaults than clang.
Zig Version
0.11.0-dev.4320+6f0a613b6
Steps to Reproduce and Observed Behavior
Single target (to be sure that I didn't mess the loop):
All targets:
Expected Behavior
All targets should be supported when using
zig cc -dM -E - </dev/null
.Note that
zig cc
works for those targets when usingzig cc -dM -E <file.c>
, and so does the compilation, so it's not clear to me why this is happening when reading fromstdin
, but it works for all the other targets, and it worked fori386-*
targets in zig v0.10.1, so this is clearly a regression from the rename tox86-*
in the v0.11.x release cycle: