[PATCH] D42702: Fix llvm-config --system-libs output on FreeBSD and NetBSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 12:10:14 PST 2018


dim created this revision.
dim added reviewers: chandlerc, emaste, joerg, krytarowski.
Herald added subscribers: llvm-commits, hintonda, mgorny.

For various reasons, CMake's detection mechanism for `backtrace()` returns an absolute path `/usr/lib/libexecinfo.so` on FreeBSD and NetBSD.

Since `tools/llvm-config/CMakeLists.txt` only checks if system libraries start with `-`, this causes `llvm-config --system-libs` to produce the following incorrect output:

  -lrt -l/usr/lib/libexecinfo.so -ltinfo -lpthread -lz -lm

Fix it by checking for both `-` and `/`, assuming the latter indicates an absolute path to a library.

This also fixes the `Bindings/Go/go.test` test case, since that always died with "unable to find library -l/usr/lib/libexecinfo.so".


Repository:
  rL LLVM

https://reviews.llvm.org/D42702

Files:
  tools/llvm-config/CMakeLists.txt


Index: tools/llvm-config/CMakeLists.txt
===================================================================
--- tools/llvm-config/CMakeLists.txt
+++ tools/llvm-config/CMakeLists.txt
@@ -14,8 +14,8 @@
   if(MSVC)
     set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}.lib")
   else()
-    if (l MATCHES "^-")
-      # If it's an option, pass it without changes.
+    if (l MATCHES "^[-/]")
+      # If it's an option, or an absolute pathname, pass it without changes.
       set(SYSTEM_LIBS ${SYSTEM_LIBS} "${l}")
     else()
       # Otherwise assume it's a library name we need to link with.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42702.132026.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/91b338e6/attachment.bin>


More information about the llvm-commits mailing list