-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang: Support for -Xassembler -target-feature
(or similar)
#97517
Comments
-Xassembler -target-feature
-Xassembler -target-feature
(or similar)
@llvm/issue-subscribers-clang-driver Author: Alex Rønne Petersen (alexrp)
Zig needs the ability to pass target features along to the integrated assembler - see https://github.com/ziglang/zig/issues/10411.
For C files, Zig uses There is a very simple change that would solve this headache: Update Clang's Alternatively, if Would either of these options be acceptable? If so, I could probably do a PR. |
Friendly ping; I'm happy to do the work here, just need to know if either approach is acceptable. 🙂 |
Exposing an arbitrary cc1as forwarder in clangDriver is not ideal. It could lead to a surge of compatibility issues "please remove the incompatible target-feature when I specify -target-feature +X". let's focus on the immediate concern. In |
Can you expand on what you mean by this? I put the If it would help alleviate concerns, could we just not document The alternative for us is completely upending our Clang wrapper code and invoking
That example is missing the forest for the trees. 🙂 The general issue is that we need a way to communicate ABI, CPU model, and CPU features to the LLVM assembler. It manifests in many other ways where it actually is a legitimate problem. For example, To understand why we can't reasonably solve this today, you have to understand that Zig fundamentally operates in terms of: 1) target triple (implies ABI), 2) CPU model (implies some CPU default features), 3) CPU features. The CPU model and features are extracted nearly 1:1 from LLVM, and due to the way CPU features are modeled in LLVM, there is no easy mapping back to Clang-level You can see our current approach for dealing with this here. It's easy to see how this is not sustainable. |
Zig needs the ability to pass target features along to the integrated assembler - see ziglang/zig#10411.
For C files, Zig uses
-Xclang -target-feature
. For assembly, the only option at the moment is to switch toclang -cc1as
but that would require massive surgery in Zig's driver code since it has a shared code path (with tons of logic) for both at the moment.There is a very simple change that would solve this headache: Update Clang's
CollectArgsForIntegratedAssembler()
to accept-target-feature
and pass it along. (Or even pass anything along, as-Xclang
does.)Alternatively, if
-Xassembler
has to be kept GNU-compatible only, we could imagine adding a new-Xclangas
that just passes the arguments through like-Xclang
.Would either of these options be acceptable? If so, I could probably do a PR.
The text was updated successfully, but these errors were encountered: