-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Generate configuration files for clang/clang++ #1548
base: master
Are you sure you want to change the base?
Conversation
For GCC, the default `-march`/`-mabi`/`-mtune` can be specified via configuring with `--with-arch`, `--with-abi` and `--with-tune`. But these options won't take affect for Clang/LLVM. For Clang/LLVM, we can use configuration files[1] to specify default options for different tools/targets. So we automatically generate two configuration files (for `clang` and `clang++`) and specify these options in them. References: [1] https://clang.llvm.org/docs/UsersManual.html#configuration-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
That's a good idea, but I haven't used the mechanism so far (so not much experience).
Assuming that command line flags have higher priority (i.e., can override the config file), this should not have any negative side-effects.
Address comments
We tried that before in our downstream, but we found that will break Let me describe that in more detail way:
And also similar case for ABI:
[1] https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/ToolChains/Arch/RISCV.cpp#L249 So why it break that mechanism? because the checking within those rule is based on those option is present or not, however put Ok, so how we deal that in our downstream? Just change the default string within the source tree :P... |
BTW I found the complicate rule for -mcpu and -march isn't document anywhere, I thought I have documented in https://github.com/riscv-non-isa/riscv-toolchain-conventions but apparently not. |
I think I have tried to add a CMake option to specify the default CPU in https://reviews.llvm.org/D144853, and @MaskRay suggested we'd better use config files. :-) And, is it really a |
That's kinda nullify the effect of |
Oh I get what you mean! Yeah, it is a break. :-(
|
Sounds a good way to go :) |
For GCC, the default
-march
/-mabi
/-mtune
can be specified via configuring with--with-arch
,--with-abi
and--with-tune
. But these options won't take affect for Clang/LLVM.For Clang/LLVM, we can use configuration files[1] to specify default options for different tools/targets. So we automatically generate two configuration files (for
clang
andclang++
) and specify these options in them.References:
[1] https://clang.llvm.org/docs/UsersManual.html#configuration-files