[PATCH] D23754: cmake: Add CLANG_GOLD_LIBDIR_SUFFIX to specify loc of LLVMgold.so

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 21 00:46:39 PDT 2016


mgorny created this revision.
mgorny added a reviewer: rafael.
mgorny added a subscriber: cfe-commits.

Add CLANG_GOLD_LIBDIR_SUFFIX that defaults to ${LLVM_LIBDIR_SUFFIX}
and can be overriden if LLVMgold.so is installed elsewhere. The use case
are multilib systems where binutils is 64-bit and clang is 32-bit,
therefore the gold plugin is installed in 64-bit libdir while clang
is not.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23793
Depends on: https://reviews.llvm.org/D23752

https://reviews.llvm.org/D23754

Files:
  CMakeLists.txt
  include/clang/Config/config.h.cmake
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -2007,7 +2007,7 @@
   // forward.
   CmdArgs.push_back("-plugin");
   std::string Plugin =
-      ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so";
+      ToolChain.getDriver().Dir + "/../lib" CLANG_GOLD_LIBDIR_SUFFIX "/LLVMgold.so";
   CmdArgs.push_back(Args.MakeArgString(Plugin));
 
   // Try to pass driver level flags relevant to LTO code generation down to
Index: include/clang/Config/config.h.cmake
===================================================================
--- include/clang/Config/config.h.cmake
+++ include/clang/Config/config.h.cmake
@@ -20,6 +20,9 @@
 /* Multilib suffix for libdir. */
 #define CLANG_LIBDIR_SUFFIX "${CLANG_LIBDIR_SUFFIX}"
 
+/* Multilib suffix for libdir containing LLVMgold.so. */
+#define CLANG_GOLD_LIBDIR_SUFFIX "${CLANG_GOLD_LIBDIR_SUFFIX}"
+
 /* Relative directory for resource files */
 #define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}"
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -239,6 +239,9 @@
   STRING "Define suffix of library directory name for clang runtime (32/64)")
 set(CLANG_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${CLANG_LIBDIR_SUFFIX})
 
+set(CLANG_GOLD_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE
+  STRING "Define suffix of library directory name that contains LLVMgold.so (32/64)")
+
 set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23754.68802.patch
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160821/46581d97/attachment-0001.bin>


More information about the cfe-commits mailing list