From: Chris Lattner Date: Tue, 16 Jun 2009 23:00:42 +0000 (+0000) Subject: Remove support for building LLVM libraries into "relinked" X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6be926647d42e149fb7ef20554899d2fe9a2e80f;p=oota-llvm.git Remove support for building LLVM libraries into "relinked" object files. Now we always build LLVM libraries into archives (.a files). This makes the 'make' build work more like the cmake build, among other things. Doing this exposed some latent circular library dependencies, so I think that llvm-config wasn't quite right for .o files anyway. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73579 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Makefile.rules b/Makefile.rules index 4a77bf536df..94d8e98c16b 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -287,10 +287,8 @@ endif ifdef ENABLE_COVERAGE BuildMode := $(BuildMode)+Coverage - # These only go to .NoRelink because otherwise we will end up - # linking -lgcov into the .o libraries that get built. - CXX.Flags.NoRelink += -ftest-coverage -fprofile-arcs - C.Flags.NoRelink += -ftest-coverage -fprofile-arcs + CXX.Flags += -ftest-coverage -fprofile-arcs + C.Flags += -ftest-coverage -fprofile-arcs endif # If DISABLE_ASSERTIONS=1 is specified (make command line or configured), @@ -315,7 +313,6 @@ endif # defined/on. ifdef LOADABLE_MODULE SHARED_LIBRARY := 1 - DONT_BUILD_RELINKED := 1 LINK_LIBS_IN_SHARED := 1 endif @@ -548,10 +545,8 @@ ifdef UNIVERSAL endif UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %) CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS) - Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS) ifdef UNIVERSAL_SDK_PATH CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH) - Relink.Flags += -isysroot $(UNIVERSAL_SDK_PATH) endif # Building universal cannot compute dependencies automatically. @@ -582,27 +577,23 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \ $(CPP.BaseFlags) ifeq ($(BUILD_COMPONENT), 1) - Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) $(C.Flags.NoRelink) \ + Compile.C = $(BUILD_CC) $(CPP.Flags) $(C.Flags) \ $(TargetCommonOpts) $(CompileCommonOpts) -c - Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ + Compile.CXX = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \ $(TargetCommonOpts) $(CompileCommonOpts) -c Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(TargetCommonOpts) \ - $(CompileCommonOpts) $(CXX.Flags) $(CXX.Flags.NoRelink) -E - Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ + $(CompileCommonOpts) $(CXX.Flags) -E + Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) - Relink = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) \ - $(CompileCommonOpts) $(Relink.Flags) else - Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(C.Flags.NoRelink) \ + Compile.C = $(CC) $(CPP.Flags) $(C.Flags) \ $(TargetCommonOpts) $(CompileCommonOpts) -c - Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ + Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) \ $(TargetCommonOpts) $(CompileCommonOpts) -c Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) \ - $(CompileCommonOpts) $(CXX.Flags) $(CXX.Flags.NoRelink) -E - Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ + $(CompileCommonOpts) $(CXX.Flags) -E + Link = $(CXX) $(CPP.Flags) $(CXX.Flags) \ $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) - Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) \ - $(CompileCommonOpts) $(Relink.Flags) endif BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) \ @@ -1048,48 +1039,13 @@ endif endif #--------------------------------------------------------- -# ReLinked Library Targets: -# If the user explicitly requests a relinked library with -# BUILD_RELINKED, provide it. Otherwise, if they specify -# neither of BUILD_ARCHIVE or DONT_BUILD_RELINKED, give -# them one. +# Library Targets: +# If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to +# building an archive. #--------------------------------------------------------- ifndef BUILD_ARCHIVE -ifndef DONT_BUILD_RELINKED -BUILD_RELINKED = 1 -endif -endif - -ifdef BUILD_RELINKED - -all-local:: $(LibName.O) - -$(LibName.O): $(ObjectsO) $(LibDir)/.dir - $(Echo) Linking $(BuildMode) Object Library $(notdir $@) - $(Verb) $(Relink) -r -nodefaultlibs -nostdlib -nostartfiles -o $@ $(ObjectsO) - -clean-local:: -ifneq ($(strip $(LibName.O)),) - -$(Verb) $(RM) -f $(LibName.O) -endif - -ifdef NO_INSTALL -install-local:: - $(Echo) Install circumvented with NO_INSTALL -uninstall-local:: - $(Echo) Uninstall circumvented with NO_INSTALL -else -DestRelinkedLib = $(PROJ_libdir)/$(LIBRARYNAME).o - -install-local:: $(DestRelinkedLib) - -$(DestRelinkedLib): $(LibName.O) $(PROJ_libdir) - $(Echo) Installing $(BuildMode) Object Library $(DestRelinkedLib) - $(Verb) $(INSTALL) $(LibName.O) $(DestRelinkedLib) - -uninstall-local:: - $(Echo) Uninstalling $(BuildMode) Object Library $(DestRelinkedLib) - -$(Verb) $(RM) -f $(DestRelinkedLib) +ifndef LOADABLE_MODULE +BUILD_ARCHIVE = 1 endif endif diff --git a/docs/MakefileGuide.html b/docs/MakefileGuide.html index 5e918bf0fd4..f996144e145 100644 --- a/docs/MakefileGuide.html +++ b/docs/MakefileGuide.html @@ -232,17 +232,16 @@ Normally, the makefile system will build all the software into a single libname.o (pre-linked) object. This means the library is not searchable and that the distinction between compilation units has been - dissolved. Optionally, you can ask for a shared library (.so), archive library - (.a) or to not have the default (relinked) library built. For example:

+ dissolved. Optionally, you can ask for a shared library (.so) or archive + library (.a) built. Archive libraries are the default. For example:


       LIBRARYNAME = mylib
       SHARED_LIBRARY = 1
       ARCHIVE_LIBRARY = 1
-      DONT_BUILD_RELINKED = 1
   

says to build a library named "mylib" with both a shared library - (mylib.so) and an archive library (mylib.a) version but - not to build the relinked object (mylib.o). The contents of all the + (mylib.so) and an archive library (mylib.a) version. The + contents of all the libraries produced will be the same, they are just constructed differently. Note that you normally do not need to specify the sources involved. The LLVM Makefile system will infer the source files from the contents of the source @@ -307,8 +306,6 @@ on.

  • The LINK_LIBS_IN_SHARED variable is turned on.
  • -
  • The DONT_BUILD_RELINKED variable - is turned on.
  • A loadable module is loaded by LLVM via the facilities of libtool's libltdl library which is part of lib/System implementation.

    @@ -637,11 +634,6 @@
    If set to any value, causes the makefiles to not automatically generate dependencies when running the compiler. Use of this feature is discouraged and it may be removed at a later date.
    -
    DONT_BUILD_RELINKED
    -
    If set to any value, causes a relinked library (.o) not to be built. By - default, libraries are built as re-linked since most LLVM libraries are - needed in their entirety and re-linked libraries will be linked more quickly - than equivalent archive libraries.
    ENABLE_OPTIMIZED
    If set to any value, causes the build to generate optimized objects, libraries and executables. This alters the flags specified to the compilers @@ -960,7 +952,6 @@ DestArchiveLib DestBitcodeLib DestModule - DestRelinkedLib DestSharedLib DestTool DistAlways @@ -1004,7 +995,6 @@ ProjUsedLibs Ranlib RecursiveTargets - Relink SrcMakefiles Strip StripWarnMsg diff --git a/tools/llvmc/driver/Makefile b/tools/llvmc/driver/Makefile index 3dd373a51ed..5f5ec533dd0 100644 --- a/tools/llvmc/driver/Makefile +++ b/tools/llvmc/driver/Makefile @@ -10,10 +10,10 @@ LEVEL = ../../.. TOOLNAME = $(LLVMC_BASED_DRIVER_NAME) -LLVMLIBS = CompilerDriver +LLVMLIBS = CompilerDriver.a ifneq ($(LLVMC_BUILTIN_PLUGINS),) -USEDLIBS += $(patsubst %,plugin_llvmc_%,$(LLVMC_BUILTIN_PLUGINS)) +USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS)) endif LINK_COMPONENTS = support system