In the past, clang --target=riscv64-unknown-linux-gnu -mno-relax -c hello.s will assemble hello.s without relaxation, but clang --target=riscv64-unknown-linux-gnu -mno-relax -fno-integrated-as -c hello.s doesn't pass the -mno-relax option to assembler, and assemble with relaxation
This patch pass the -mno-relax option to assembler when -fno-integrated-as is specified.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/test/Driver/riscv-gnutools.c | ||
---|---|---|
19 | Yeah, the comment is kind of misleading, actually we didn't check *default* value for -march or -mabi like other two checks(CHECK-RV32IMAC-ILP32/CHECK-RV32IMAFDC-ILP32D). Maybe like this? // Check -mno-relax has passed when `-fno-integrated-as` specified |
It would be good to have someone else who's reviewed earlier versions of this patch to confirm, but this LGTM. Thanks.
If you were editing it anyway, you could change "has passed" to "is passed" (though it's not a particularly important grammatical fix).
clang/lib/Driver/ToolChains/Gnu.cpp | ||
---|---|---|
764 | Avoid using the error-prone default argument true. | |
clang/test/Driver/riscv-gnutools.c | ||
44 | I don't think repeating this for 64-bit adds value. It may be more useful to change this to test -mno-relax -mrelax instead. -target riscv64 should be --target=riscv64-unknown-elf, matching the triple name in %S/Inputs/basic_riscv64_tree . |
LGTM if you use addOptOutFlag
clang/lib/Driver/ToolChains/Gnu.cpp | ||
---|---|---|
764 | Args.addOptOutFlag(CmdArgs, options::OPT_mrelax, options::OPT_mno_relax) |
I doubt this does the right thing for -mrelax -mno-relax? I imagine you want Args.hasFlag.