Description
Extracted from #4784
Status quo:
Even when doing zig cc
, -target
is parsed as Zig's -target
flag, which is different in some ways than clang's, as it contains (optional) os version info, glibc version info, and it's proposed (#4584) to have cpu feature syntax as well. Similarly, -mcpu
, -march
, and -mtune
are all treated identically, as the zig -mcpu
parameter. This is useful since the zig syntax allows specifying CPU model name and features.
This proposal is to add more code to support these options to be strictly compliant with clang's syntax. This would potentially improve the "drop-in" robustness of this feature, at the expense of the extra info that zig's syntax supports. If this proposal is implemented, then zig cc
probably would need to introduce a few of its own non-standard flags to support specifying this additional information.
As an argument for not doing this, it's simpler and more powerful to leave things as status quo, and often, the reason people are using zig cc
is for cross compiling anyway, in which case they will be putting the -target
and/or -mcpu
flags as part of the CC
environment variable or equivalent. For this use case status quo is actually preferable.