![]() The Linux kernel has a make macro called cc-option that invokes the compiler with an option in isolation to see if it is supported before adding it to CFLAGS. The exit code of the compiler is used to determine if the flag is supported and should be added to the compiler invocation. A call to cc-option with '-mno-outline-atomics' was added to prevent linking errors with newer GCC versions but this call succeeds with a non-AArch64 target because there is no warning from clang with '-mno-outline-atomics', just '-moutline-atomics'. Because the call succeeds and adds '-mno-outline-atomics' to the compiler invocation, there is a warning from LLVM because the 'outline-atomics target feature is only supported by the AArch64 backend. $ echo | clang -target x86_64 -moutline-atomics -Werror -x c -c -o /dev/null - clang-14: error: The 'x86_64' architecture does not support -moutline-atomics; flag ignored [-Werror,-Woption-ignored] $ echo $? 1 $ echo | clang -target x86_64 -mno-outline-atomics -Werror -x c -c -o /dev/null - '-outline-atomics' is not a recognized feature for this target (ignoring feature) $ echo $? 0 This does not match GCC's behavior, which errors when the flag is added to a non-AArch64 target. $ echo | gcc -moutline-atomics -x c -c -o /dev/null - gcc: error: unrecognized command-line option ‘-moutline-atomics’; did you mean ‘-finline-atomics’? $ echo | gcc -mno-outline-atomics -x c -c -o /dev/null - gcc: error: unrecognized command-line option ‘-mno-outline-atomics’; did you mean ‘-fno-inline-atomics’? $ echo | aarch64-linux-gnu-gcc -moutline-atomics -x c -c -o /dev/null - $ echo | aarch64-linux-gnu-gcc -mno-outline-atomics -x c -c -o /dev/null - To get closer to GCC's behavior, issue a warning when '-mno-outline-atomics' is used without an AArch64 triple and do not add '{-,+}outline-atomic" to the list of target features in these cases. Link: https://github.com/ClangBuiltLinux/linux/issues/1552 Reviewed By: melver, nickdesaulniers Differential Revision: https://reviews.llvm.org/D116128 |
||
---|---|---|
.. | ||
INPUTS | ||
bindings | ||
cmake | ||
docs | ||
examples | ||
include | ||
lib | ||
runtime | ||
test | ||
tools | ||
unittests | ||
utils | ||
www | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
CMakeLists.txt | ||
CODE_OWNERS.TXT | ||
INSTALL.txt | ||
LICENSE.TXT | ||
ModuleInfo.txt | ||
NOTES.txt | ||
README.txt |
README.txt
//===----------------------------------------------------------------------===// // C Language Family Front-end //===----------------------------------------------------------------------===// Welcome to Clang. This is a compiler front-end for the C family of languages (C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM compiler infrastructure project. Unlike many other compiler frontends, Clang is useful for a number of things beyond just compiling code: we intend for Clang to be host to a number of different source-level tools. One example of this is the Clang Static Analyzer. If you're interested in more (including how to build Clang) it is best to read the relevant web sites. Here are some pointers: Information on Clang: http://clang.llvm.org/ Building and using Clang: http://clang.llvm.org/get_started.html Clang Static Analyzer: http://clang-analyzer.llvm.org/ Information on the LLVM project: http://llvm.org/ If you have questions or comments about Clang, a great place to discuss them is on the Clang development mailing list: http://lists.llvm.org/mailman/listinfo/cfe-dev If you find a bug in Clang, please file it in the LLVM bug tracker: http://llvm.org/bugs/