From c20f89496e19956c7224fe374d153faf46ac0a20 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Tue, 14 Jul 2015 15:10:34 +0000 Subject: [PATCH] Revert "Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components." This reverts commit 01446706b4c0a86bb64768f307079cab5c514aa3. Causes breakage, seems to be related to 'svn' in the file's name: CC=gcc CXX=g++ \ ../llvm/configure \ --prefix=/usr \ --sysconfdir=/etc \ --enable-shared \ --enable-libffi \ --enable-targets=all \ --disable-assertions \ --with-python=/usr/bin/python2 \ --enable-optimized make REQUIRES_RTTI=1 ENABLE_PIC=1 results: llvm[2]: Linking Release unit test Support (without symbols) llvm[2]: ======= Finished Linking Release Unit test Support (without symbols) make[3]: Entering directory '/build/llvm-svn/src/build/bindings/ocaml/llvm' make[3]: *** No rule to make target '/build/llvm- svn/src/build/Release/lib/ocaml/libLLVM-3.7.0svn.so', needed by 'build- deplibs'. Stop. make[3]: *** Waiting for unfinished jobs.... llvm[3]: Compiling llvm_ocaml.c for Release build make[3]: Leaving directory '/build/llvm-svn/src/build/bindings/ocaml/llvm' /build/llvm-svn/src/llvm/Makefile.rules:880: recipe for target 'all' failed /build/llvm-svn/src/llvm/Makefile.rules:965: recipe for target 'all' failed Differential Revision: http://reviews.llvm.org/D10716 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242152 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-config/BuildVariables.inc.in | 2 -- tools/llvm-config/CMakeLists.txt | 1 - tools/llvm-config/Makefile | 6 ---- tools/llvm-config/llvm-config.cpp | 43 ++----------------------- 4 files changed, 2 insertions(+), 50 deletions(-) diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in index 66f7a16a4ce..3f51f491a7a 100644 --- a/tools/llvm-config/BuildVariables.inc.in +++ b/tools/llvm-config/BuildVariables.inc.in @@ -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@" diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt index 3d5c9e68e11..d2ef45a1681 100644 --- a/tools/llvm-config/CMakeLists.txt +++ b/tools/llvm-config/CMakeLists.txt @@ -20,7 +20,6 @@ set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_ 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) diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile index 11e5d338771..1ff8b6f0406 100644 --- a/tools/llvm-config/Makefile +++ b/tools/llvm-config/Makefile @@ -65,12 +65,6 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir >> 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 diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp index c007d71baf1..879b9ab0945 100644 --- a/tools/llvm-config/llvm-config.cpp +++ b/tools/llvm-config/llvm-config.cpp @@ -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; } -- 2.34.1