[llvm] r244108 - Revert "Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components."

Richard Diamond wichard at vitalitystudios.com
Wed Aug 5 13:03:26 PDT 2015


Author: diamond
Date: Wed Aug  5 15:03:26 2015
New Revision: 244108

URL: http://llvm.org/viewvc/llvm-project?rev=244108&view=rev
Log:
Revert "Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components."

It seems I was wrong thinking `autoconf`/`make` only installed shared libraries if configured with `--enable-shared`, even if `--disable-static` is present. I'll re-address with a followup patch.

This reverts commit r243297 for causing PR#24154.

Modified:
    llvm/trunk/bindings/ocaml/Makefile.ocaml
    llvm/trunk/tools/llvm-config/BuildVariables.inc.in
    llvm/trunk/tools/llvm-config/CMakeLists.txt
    llvm/trunk/tools/llvm-config/Makefile
    llvm/trunk/tools/llvm-config/llvm-config.cpp

Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=244108&r1=244107&r2=244108&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/Makefile.ocaml (original)
+++ llvm/trunk/bindings/ocaml/Makefile.ocaml Wed Aug  5 15:03:26 2015
@@ -277,8 +277,6 @@ uninstall-local:: uninstall-deplibs
 
 build-deplibs: $(OutputLibs)
 
-$(OcamlDir)/%.so: $(LibDir)/%.so
-	$(Verb) ln -sf $< $@
 $(OcamlDir)/%.a: $(LibDir)/%.a
 	$(Verb) ln -sf $< $@
 

Modified: llvm/trunk/tools/llvm-config/BuildVariables.inc.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/BuildVariables.inc.in?rev=244108&r1=244107&r2=244108&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/BuildVariables.inc.in (original)
+++ llvm/trunk/tools/llvm-config/BuildVariables.inc.in Wed Aug  5 15:03:26 2015
@@ -26,5 +26,3 @@
 #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
-#define BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@"
-#define WAS_BUILT_WITH_CMAKE "@WAS_BUILT_WITH_CMAKE@"

Modified: llvm/trunk/tools/llvm-config/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/CMakeLists.txt?rev=244108&r1=244107&r2=244108&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-config/CMakeLists.txt Wed Aug  5 15:03:26 2015
@@ -20,7 +20,6 @@ set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${
 set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
 set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
 set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
-set(WAS_BUILT_WITH_CMAKE "ON")
 string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}")
 configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
 

Modified: llvm/trunk/tools/llvm-config/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/Makefile?rev=244108&r1=244107&r2=244108&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/Makefile (original)
+++ llvm/trunk/tools/llvm-config/Makefile Wed Aug  5 15:03:26 2015
@@ -65,12 +65,6 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVAR
 	  >> temp.sed
 	$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
 	  >> temp.sed
-	$(if $(filter-out $(ENABLE_SHARED),0),\
-	  $(Verb) $(ECHO) 's/@BUILD_SHARED_LIBS@/ON/',\
-	  $(Verb) $(ECHO) 's/@BUILD_SHARED_LIBS@/OFF/') \
-	  >> temp.sed
-	$(Verb) $(ECHO) 's/@WAS_BUILT_WITH_CMAKE@/OFF/' \
-	  >> temp.sed
 	$(Verb) $(SED) -f temp.sed < $< > $@
 	$(Verb) $(RM) temp.sed
 

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=244108&r1=244107&r2=244108&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Wed Aug  5 15:03:26 2015
@@ -349,30 +349,6 @@ int main(int argc, char **argv) {
                              /*IncludeNonInstalled=*/IsInDevelopmentTree);
 
     if (PrintLibs || PrintLibNames || PrintLibFiles) {
-      // If LLVM was built as a shared library, there will be only one thing
-      // that users should link against.
-      const bool IsSharedLib = (std::strcmp(BUILD_SHARED_LIBS, "ON") == 0);
-      const bool WasBuiltWithCMake = (std::strcmp(WAS_BUILT_WITH_CMAKE, "ON") == 0);
-      // CMake correctly builds components as separate shared libraries, however
-      // autoconfig/make builds components a static libraries and then links
-      // them all together to form a single shared library. Thus, only when
-      // `WAS_BUILT_WITH_CMAKE` is `OFF` and `BUILD_SHARED_LIBS` is `ON` do we
-      // override `RequiredLibs` with the single library name.
-      if (IsSharedLib && !WasBuiltWithCMake) {
-        RequiredLibs.clear();
-        std::string Name = "libLLVM-" PACKAGE_VERSION;
-        const Triple HostTriple(LLVM_DEFAULT_TARGET_TRIPLE);
-        if (HostTriple.isOSWindows()) {
-          Name += ".dll";
-        } else if (HostTriple.isOSDarwin()) {
-          Name += ".dylib";
-        } else {
-          // default to linux' ext:
-          Name += ".so";
-        }
-        RequiredLibs.push_back(Name);
-      }
-
       for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
         StringRef Lib = RequiredLibs[i];
         if (i)
@@ -384,23 +360,8 @@ int main(int argc, char **argv) {
           OS << ActiveLibDir << '/' << Lib;
         } else if (PrintLibs) {
           // If this is a typical library name, include it using -l.
-          if (Lib.startswith("lib")) {
-            size_t FromEnd = 0;
-            if (Lib.endswith(".a")) {
-              FromEnd = 2;
-            } else if (Lib.endswith(".so")) {
-              FromEnd = 3;
-            } else if (Lib.endswith(".dylib")) {
-              FromEnd = 6;
-            } else {
-              FromEnd = 0;
-            }
-
-            if (FromEnd != 0) {
-              OS << "-l" << Lib.slice(3, Lib.size() - FromEnd);
-            } else {
-              OS << "-l:" << Lib;
-            }
+          if (Lib.startswith("lib") && Lib.endswith(".a")) {
+            OS << "-l" << Lib.slice(3, Lib.size()-2);
             continue;
           }
 




More information about the llvm-commits mailing list