[llvm] r289488 - [llvm-config] Fix bug where `--libfiles` and `--names` would produce
Dan Liew via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 15:07:23 PST 2016
Author: delcypher
Date: Mon Dec 12 17:07:22 2016
New Revision: 289488
URL: http://llvm.org/viewvc/llvm-project?rev=289488&view=rev
Log:
[llvm-config] Fix bug where `--libfiles` and `--names` would produce
incorrect output when LLVM is built with `LLVM_BUILD_LLVM_DYLIB`.
`llvm-config` previously produced output like this
```
$ llvm-config --libfiles
/usr/lib/liblibLLVM-4.0svn.so.so
$ llvm-config --libnames
liblibLLVM-4.0svn.so.so
```
The library prefix and shared library extension were added to
the library name twice which was wrong.
I wanted to write a test cases for this but it looks like **all**
`llvm-config` tests were disabled by r260386 so I'll leave this for
now.
Subscribers: llvm-commits, tstellarAMD
Reviewers: beanz, DiamondLovesYou, axw
Differential Revision: https://reviews.llvm.org/D27393
Modified:
llvm/trunk/tools/llvm-config/llvm-config.cpp
Modified: llvm/trunk/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.cpp?rev=289488&r1=289487&r2=289488&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Mon Dec 12 17:07:22 2016
@@ -432,7 +432,15 @@ int main(int argc, char **argv) {
const bool Shared) {
std::string LibFileName;
if (Shared) {
- LibFileName = (SharedPrefix + Lib + "." + SharedExt).str();
+ if (Lib == DyLibName) {
+ // Treat the DyLibName specially. It is not a component library and
+ // already has the necessary prefix and suffix (e.g. `.so`) added so
+ // just return it unmodified.
+ assert(Lib.endswith(SharedExt) && "DyLib is missing suffix");
+ LibFileName = Lib;
+ } else {
+ LibFileName = (SharedPrefix + Lib + "." + SharedExt).str();
+ }
} else {
// default to static
LibFileName = (StaticPrefix + Lib + "." + StaticExt).str();
More information about the llvm-commits
mailing list