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
This commit is contained in:
Chris Lattner
2009-06-16 23:00:42 +00:00
parent 1527f5442a
commit 6be926647d
3 changed files with 21 additions and 75 deletions

View File

@@ -287,10 +287,8 @@ endif
ifdef ENABLE_COVERAGE ifdef ENABLE_COVERAGE
BuildMode := $(BuildMode)+Coverage BuildMode := $(BuildMode)+Coverage
# These only go to .NoRelink because otherwise we will end up CXX.Flags += -ftest-coverage -fprofile-arcs
# linking -lgcov into the .o libraries that get built. C.Flags += -ftest-coverage -fprofile-arcs
CXX.Flags.NoRelink += -ftest-coverage -fprofile-arcs
C.Flags.NoRelink += -ftest-coverage -fprofile-arcs
endif endif
# If DISABLE_ASSERTIONS=1 is specified (make command line or configured), # If DISABLE_ASSERTIONS=1 is specified (make command line or configured),
@@ -315,7 +313,6 @@ endif
# defined/on. # defined/on.
ifdef LOADABLE_MODULE ifdef LOADABLE_MODULE
SHARED_LIBRARY := 1 SHARED_LIBRARY := 1
DONT_BUILD_RELINKED := 1
LINK_LIBS_IN_SHARED := 1 LINK_LIBS_IN_SHARED := 1
endif endif
@@ -548,10 +545,8 @@ ifdef UNIVERSAL
endif endif
UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %) UNIVERSAL_ARCH_OPTIONS := $(UNIVERSAL_ARCH:%=-arch %)
CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS) CompileCommonOpts += $(UNIVERSAL_ARCH_OPTIONS)
Relink.Flags := $(UNIVERSAL_ARCH_OPTIONS)
ifdef UNIVERSAL_SDK_PATH ifdef UNIVERSAL_SDK_PATH
CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH) CompileCommonOpts += -isysroot $(UNIVERSAL_SDK_PATH)
Relink.Flags += -isysroot $(UNIVERSAL_SDK_PATH)
endif endif
# Building universal cannot compute dependencies automatically. # Building universal cannot compute dependencies automatically.
@@ -582,27 +577,23 @@ CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
$(CPP.BaseFlags) $(CPP.BaseFlags)
ifeq ($(BUILD_COMPONENT), 1) 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 $(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 $(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(TargetCommonOpts) \ Preprocess.CXX= $(BUILD_CXX) $(CPP.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(CXX.Flags) $(CXX.Flags.NoRelink) -E $(CompileCommonOpts) $(CXX.Flags) -E
Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ Link = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
Relink = $(BUILD_CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(Relink.Flags)
else else
Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(C.Flags.NoRelink) \ Compile.C = $(CC) $(CPP.Flags) $(C.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) -c $(TargetCommonOpts) $(CompileCommonOpts) -c
Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) -c $(TargetCommonOpts) $(CompileCommonOpts) -c
Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) \ Preprocess.CXX= $(CXX) $(CPP.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(CXX.Flags) $(CXX.Flags.NoRelink) -E $(CompileCommonOpts) $(CXX.Flags) -E
Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CXX.Flags.NoRelink) \ Link = $(CXX) $(CPP.Flags) $(CXX.Flags) \
$(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) $(Strip)
Relink = $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) \
$(CompileCommonOpts) $(Relink.Flags)
endif endif
BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) \ BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) \
@@ -1048,48 +1039,13 @@ endif
endif endif
#--------------------------------------------------------- #---------------------------------------------------------
# ReLinked Library Targets: # Library Targets:
# If the user explicitly requests a relinked library with # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
# BUILD_RELINKED, provide it. Otherwise, if they specify # building an archive.
# neither of BUILD_ARCHIVE or DONT_BUILD_RELINKED, give
# them one.
#--------------------------------------------------------- #---------------------------------------------------------
ifndef BUILD_ARCHIVE ifndef BUILD_ARCHIVE
ifndef DONT_BUILD_RELINKED ifndef LOADABLE_MODULE
BUILD_RELINKED = 1 BUILD_ARCHIVE = 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)
endif endif
endif endif

View File

@@ -232,17 +232,16 @@
Normally, the makefile system will build all the software into a single Normally, the makefile system will build all the software into a single
<tt>libname.o</tt> (pre-linked) object. This means the library is not <tt>libname.o</tt> (pre-linked) object. This means the library is not
searchable and that the distinction between compilation units has been searchable and that the distinction between compilation units has been
dissolved. Optionally, you can ask for a shared library (.so), archive library dissolved. Optionally, you can ask for a shared library (.so) or archive
(.a) or to not have the default (relinked) library built. For example:</p> library (.a) built. Archive libraries are the default. For example:</p>
<pre><tt> <pre><tt>
LIBRARYNAME = mylib LIBRARYNAME = mylib
SHARED_LIBRARY = 1 SHARED_LIBRARY = 1
ARCHIVE_LIBRARY = 1 ARCHIVE_LIBRARY = 1
DONT_BUILD_RELINKED = 1
</tt></pre> </tt></pre>
<p>says to build a library named "mylib" with both a shared library <p>says to build a library named "mylib" with both a shared library
(<tt>mylib.so</tt>) and an archive library (<tt>mylib.a</tt>) version but (<tt>mylib.so</tt>) and an archive library (<tt>mylib.a</tt>) version. The
not to build the relinked object (<tt>mylib.o</tt>). The contents of all the contents of all the
libraries produced will be the same, they are just constructed differently. 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 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 Makefile system will infer the source files from the contents of the source
@@ -307,8 +306,6 @@
on.</li> on.</li>
<li>The <a href="#LINK_LIBS_IN_SHARED">LINK_LIBS_IN_SHARED</a> variable <li>The <a href="#LINK_LIBS_IN_SHARED">LINK_LIBS_IN_SHARED</a> variable
is turned on.</li> is turned on.</li>
<li>The <a href="#DONT_BUILD_RELINKED">DONT_BUILD_RELINKED</a> variable
is turned on.</li>
</ol> </ol>
<p>A loadable module is loaded by LLVM via the facilities of libtool's libltdl <p>A loadable module is loaded by LLVM via the facilities of libtool's libltdl
library which is part of <tt>lib/System</tt> implementation.</p> library which is part of <tt>lib/System</tt> implementation.</p>
@@ -637,11 +634,6 @@
<dd>If set to any value, causes the makefiles to <b>not</b> automatically <dd>If set to any value, causes the makefiles to <b>not</b> automatically
generate dependencies when running the compiler. Use of this feature is generate dependencies when running the compiler. Use of this feature is
discouraged and it may be removed at a later date.</dd> discouraged and it may be removed at a later date.</dd>
<dt><a name="DONT_BUILD_RELINKED"><tt>DONT_BUILD_RELINKED</tt></a></dt>
<dd>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.</dd>
<dt><a name="ENABLE_OPTIMIZED"><tt>ENABLE_OPTIMIZED</tt></a></dt> <dt><a name="ENABLE_OPTIMIZED"><tt>ENABLE_OPTIMIZED</tt></a></dt>
<dd>If set to any value, causes the build to generate optimized objects, <dd>If set to any value, causes the build to generate optimized objects,
libraries and executables. This alters the flags specified to the compilers libraries and executables. This alters the flags specified to the compilers
@@ -960,7 +952,6 @@
DestArchiveLib DestArchiveLib
DestBitcodeLib DestBitcodeLib
DestModule DestModule
DestRelinkedLib
DestSharedLib DestSharedLib
DestTool DestTool
DistAlways DistAlways
@@ -1004,7 +995,6 @@
ProjUsedLibs ProjUsedLibs
Ranlib Ranlib
RecursiveTargets RecursiveTargets
Relink
SrcMakefiles SrcMakefiles
Strip Strip
StripWarnMsg StripWarnMsg

View File

@@ -10,10 +10,10 @@
LEVEL = ../../.. LEVEL = ../../..
TOOLNAME = $(LLVMC_BASED_DRIVER_NAME) TOOLNAME = $(LLVMC_BASED_DRIVER_NAME)
LLVMLIBS = CompilerDriver LLVMLIBS = CompilerDriver.a
ifneq ($(LLVMC_BUILTIN_PLUGINS),) ifneq ($(LLVMC_BUILTIN_PLUGINS),)
USEDLIBS += $(patsubst %,plugin_llvmc_%,$(LLVMC_BUILTIN_PLUGINS)) USEDLIBS += $(patsubst %,plugin_llvmc_%.a,$(LLVMC_BUILTIN_PLUGINS))
endif endif
LINK_COMPONENTS = support system LINK_COMPONENTS = support system