DriverOption seems to be accidentally removed from integrated_as definition in
commit e5158b5.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Is there missing test coverage for this in some way? (how does this patch change the observable behavior of clang? I guess --help would change?)
Actually, this patch won't change --help because it just reduced some duplication by extracting the common part (" the integrated assembler") of the help message into the "help" of "OptOutFFlag". Sorry for the confusion.
The real fix here is to restore "integrated_as" as a DriverOption. Without this, when we have -fintegrated-as on a link line, it will be passed to the linker and cause the linker to fail because it is not a valid linker flag.
Sounds like that could be tested with a driver test (using -### to see what the linker command would be and validating that it doesn't include -fintegrated-as? - see other similar tests in clang/test/Driver, I think)
The description is not correct. The actual difference is:
static bool forwardToGCC(const Option &O) { // Don't forward inputs from the original command line. They are added from // InputInfoList. return O.getKind() != Option::InputClass && !O.hasFlag(options::DriverOption) && !O.hasFlag(options::LinkerInput); }
If clang::driver::tools::gcc::Common is selected, DriverOption modified options are not forwarded to gcc.
clang -target x86_64-linux -fintegrated-as a.o '-###' => no -fintegrated-as
clang -target x86_64 -fintegrated-as a.o '-###' => "/usr/bin/gcc" "-fintegrated-as" "-m64" "-o" "a.out" "a.o"
In this sense, all -f options not recognized by GCC should have a DriverOption tag.... I don't think we have properly tagged all options.
clang/test/Driver/integrated-as.c | ||
---|---|---|
11 | This test is incorrect. You need a specific target triple to select bare-metal like GCC driver. |
clang/test/Driver/integrated-as.c | ||
---|---|---|
11 | There are so many clang specific options. I think we just need a centralized test file to test options in patch, instead of adding random -NOT check lines to random files. |
Actually, the way we tag options recognized by GCC is wrong. There are few options which can be used on the GCC linking command line. So we should tag the options which can be used, rather than options which can't be used.
Created http://lists.llvm.org/pipermail/cfe-dev/2020-July/066245.html [cfe-dev] Usage of clang::driver::options::DriverOption (-Xarch_ & gcc toolchain)
to ask about the use case.
When I get time, I'll work on a patch fixing the whole class of options instead of just -fintegrated-as. I will use OPT_Link_Group and add some extra options in the new group: GCCLinkOption.
This test is incorrect. You need a specific target triple to select bare-metal like GCC driver.