diff options
author | Reid Kleckner <rnk@google.com> | 2016-03-14 21:39:58 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-03-14 21:39:58 +0000 |
commit | ecb4090716e095f11b8c3d3794a143805d38b095 (patch) | |
tree | 9e7d2f243540bbc0e6a1b462ec061c3efea5f14a | |
parent | 64bd8df458755858cee6c92e9c976c0949b4b94c (diff) | |
download | bcm5719-llvm-ecb4090716e095f11b8c3d3794a143805d38b095.tar.gz bcm5719-llvm-ecb4090716e095f11b8c3d3794a143805d38b095.zip |
llvm-config: fix --libs on Linux
Summary:
llvm-config --libs does not produce correct output since commit r260263
(llvm-config: Add preliminary Windows support) changed naming format of
the libraries. This patch updates llvm-config to recognize new naming
format and output correct linker flags.
Ref: https://llvm.org/bugs/show_bug.cgi?id=26581
Patch by Vedran Miletić
Reviewers: ehsan, rnk, pxli168
Subscribers: pxli168
Differential Revision: http://reviews.llvm.org/D17300
llvm-svn: 263497
-rw-r--r-- | llvm/tools/llvm-config/llvm-config.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index c0e48323b3a..94d426be361 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -645,17 +645,19 @@ int main(int argc, char **argv) { } else if (PrintLibFiles) { OS << GetComponentLibraryPath(Lib, Shared); } else if (PrintLibs) { - // If this is a typical library name, include it using -l. - StringRef LibName; - if (Lib.startswith("lib")) { + // On Windows, output full path to library without parameters. + // Elsewhere, if this is a typical library name, include it using -l. + if (HostTriple.isWindowsMSVCEnvironment()) { + OS << GetComponentLibraryPath(Lib, Shared); + } else { + StringRef LibName; if (GetComponentLibraryNameSlice(Lib, LibName)) { + // Extract library name (remove prefix and suffix). OS << "-l" << LibName; } else { - OS << "-l:" << GetComponentLibraryFileName(Lib, Shared); + // Lib is already a library name without prefix and suffix. + OS << "-l" << Lib; } - } else { - // Otherwise, print the full path. - OS << GetComponentLibraryPath(Lib, Shared); } } }; |