Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What flags does -march=native activate with Clang?

With GCC one is able to print out the specific flags that -march=native triggers. Is it possible to have Clang print similar information?

like image 707
Christopher Johnson Avatar asked Feb 12 '16 08:02

Christopher Johnson


People also ask

Is clang owned by Apple?

In the end, Apple chose to develop Clang, a new compiler front end that supports C, Objective-C and C++. In July 2007, the project received the approval for becoming open-source.

Does clang use Libstdc ++?

Clang supports use of either LLVM's libc++ or GCC's libstdc++ implementation of the C++ standard library.

Does clang use MSVC?

When Clang compiles C++ code for Windows, it attempts to be compatible with MSVC. There are multiple dimensions to compatibility. First, Clang attempts to be ABI-compatible, meaning that Clang-compiled code should be able to link against MSVC-compiled code successfully.

Is clang faster than GCC?

Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.

Why demystify Clang optimization Flags?

My vision is to demystify clang optimization flags so that you’ll be able to make best use of them and use different Clang optimization flags. The post would use Clang in Windows environment (yes, Clang supports Windows compilations as mentioned in my previous blogs mentioned above).

Is it possible to use Clang's symbol attribute in GCC?

Clang’s implementation of this attribute is compatible with GCC’s, documented here. While it is possible to use this attribute to name a special symbol used internally by the compiler, such as an LLVM intrinsic, this is neither recommended nor supported and may cause the compiler to crash or miscompile.

What does the-wunused flag do in Clang?

When passing the -Wunused flag to Clang, entities that are unused by the program may be diagnosed. The [ [maybe_unused]] (or __attribute__ ( (unused))) attribute can be used to silence such diagnostics when the entity cannot be removed.

What are the different calling conventions supported by Clang?

Clang supports several different calling conventions, depending on the target platform and architecture. The calling convention used for a function determines how parameters are passed, how results are returned to the caller, and other low-level details of calling a function.


1 Answers

Instead of using the (non-existent in clang) -help=target flag, you can use echo | clang -E - -march=native -### to print out the compilation command. While this doesn't list the non-triggered flags and it's not pretty, it does list all the enabled flags.

like image 155
Avi Ginsburg Avatar answered Nov 27 '22 08:11

Avi Ginsburg