Clang currently only supports -Wa,--version when -no-integrated-as is
used. This adds support to -Wa,--version with -integrated-as.
Details
- Reviewers
nickdesaulniers MaskRay - Commits
- rG3cc3c0f8352e: Add support to -Wa,--version in clang
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
100 ms | x64 windows > Clang.Driver::as-version.s |
Event Timeline
gcc does not understand options in -Wa, so -Wa,--version needs to be used this way: gcc -Wa,--version -c -x assembler /dev/null -o /dev/null
The verbose syntax makes it not that useful. If the kernel really wants to use it, I have no issue with it.
-integrated-as => -fintegrated-as. -i* options are generally used for include related features.
Similarly, -no-integrated-as => -fno-integrated-as
clang/test/Driver/as-options.s | ||
---|---|---|
40 ↗ | (On Diff #334027) | Drop 2>&1 because you specifically want to test stdout. |
I agree; the kernel only uses the compiler as the driver for assembler sources, as the kernel assembler is almost entirely -x assembler-with-cpp, so the C pre processor must be run first over the sources. This is done to share important constants like the PAGE_SIZE between C and assembler. For this reason, the maintainer of the kernel build system (Kbuild) would prefer to detect assembler version via $(CC) -Wa,--version.
@jcai19 would you mind adding a test like clang/test/Driver/version.c? clang/test/Driver/version.s perhaps? Testing that there is some output from -Wa,--version might be helpful.
clang/test/Driver/as-version.s | ||
---|---|---|
10 | What happens if we run this on windows (where I suspect that GAS isn't available)? Perhaps a CHECK-NOT: clang would be better? |
Update tests.
clang/test/Driver/as-version.s | ||
---|---|---|
10 | CHECK-NOT does sound safer in this case. I've updated the test. Thanks. |
clang/test/Driver/as-version.s | ||
---|---|---|
3 | Delete excess spaces |
Looks like the test fails on non-linux:
http://45.33.8.238/macm1/6631/step_6.txt
Please take a look and revert for now if it takes a while to fix.
ah, sorry, I think we're missing a // REQUIRES: linux in the newly added test? I've pushed a revert for now.
It also fails with the PS4 triple because we default to an external assembler that isn't present: https://lab.llvm.org/buildbot/#/builders/139/builds/2161/steps/6/logs/FAIL__Clang__as-version_s
Or split it out into a separate test file with // REQUIRES: linux. Either actually is fine by me.
No, we should reduce reliance on the host system. Printing ....as is fine (with -B), but invoking it to get the output is not something we should do in isolated tests.
Relanded without -fno-initegrated-as case at https://reviews.llvm.org/rG76d9bc72784d88f4dd57b9939e52c73739438af5.
In the future, please include Differential Revision: for relands so that the Commits line displays the associated commits :)
Delete excess spaces