Is there an equivalent to .spec files for Clang/LL

2019-04-24 13:47发布

问题:

The gcc driver can be configured to use a particular linker, particular options and other details (e.g. overriding system headers) using .specs files.

The current (as of this writing) manual for version of GCC (4.9.0) describes the Spec Files here.

Is there a similar mechanism for Clang/LLVM. Apparently Clang has the notion of a driver as well, but I was unable to come up with any documentation on whether Spec Files or a similar mechanism exist for Clang and how to use them.

I am interested in this for both C and C++, but probably a pointer to either of them will get me started.

Goal is to override the system header and library paths as well as the linker as briefly mentioned before.

回答1:

According to the docs, the Clang driver doesn't have a direct equivalent to GCC spec files:

The clang driver has no direct correspondent for “specs”. The majority of the functionality that is embedded in specs is in the Tool specific argument translation routines. The parts of specs which control the compilation pipeline are generally part of the Pipeline stage.

The #include search path can be overridden using -nostdinc and -isystem.

However, I don't know how to override the linker or fully override the library search path.



标签: c++ c gcc clang