[llvm-commits] CVS: llvm/Makefile.rules

Reid Spencer reid at x10sys.com
Thu Dec 2 01:28:32 PST 2004



Changes in directory llvm:

Makefile.rules updated: 1.243 -> 1.244
---
Log message:

For PR466: http://llvm.cs.uiuc.edu/PR466 :
Change construction of bytecode libraries from producing a single bytecode
file to producing a library containing bytecode files. This gets around the
problem of multiple symbol definitions in the linker if something like
-lc -lc is attempted on the command line. Previously this happened because
the linker would find libc.bc as a "library". It will now find libc.a which
it can simply search for missing symbols instead of linking in wholesale.


---
Diffs of the changes:  (+27 -24)

Index: llvm/Makefile.rules
diff -u llvm/Makefile.rules:1.243 llvm/Makefile.rules:1.244
--- llvm/Makefile.rules:1.243	Mon Nov 29 13:47:58 2004
+++ llvm/Makefile.rules	Thu Dec  2 03:28:21 2004
@@ -232,8 +232,8 @@
   C.Flags += -v
   CXX.Flags += -v
   LD.Flags += -v
-  BCLinkLib.Flags += -v
   VERBOSE := 1
+else
 endif
 
 # Adjust settings for verbose mode
@@ -286,12 +286,11 @@
 	        $(CompileCommonOpts) $(LD.Flags) $(Strip)
 Relink        = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
                 $(CompileCommonOpts)
-BCLinkLib     = $(LLVMGCC) -shared -nostdlib $(BCLinkLib.Flags)
 LTInstall     = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
 Burg          = $(BURG) -I $(BUILD_SRC_DIR)
 TableGen      = $(TBLGEN) -I $(BUILD_SRC_DIR)
 Archive       = $(AR) $(AR.Flags)
-LArchive      = $(ToolDir)/llvm-ar rcsf
+LArchive      = $(LLVMToolDir)/llvm-ar rcsf
 ifdef RANLIB
 Ranlib        = $(RANLIB)
 else
@@ -466,7 +465,7 @@
 LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
 LibName.A  := $(LibDir)/lib$(LIBRARYNAME).a
 LibName.O  := $(LibDir)/$(LIBRARYNAME).o
-LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
+LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
 
 #---------------------------------------------------------
 # Shared Library Targets:
@@ -511,37 +510,41 @@
 #---------------------------------------------------------
 ifdef BYTECODE_LIBRARY
 
-ifdef EXPORTED_SYMBOL_LIST
-  BCLinkLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
+all-local:: $(LibName.BCA)
+
+ifdef EXPORTED_SYMBOL_FILE
+BCLinkLib = $(LLVMGCC) -shared -nostdlib -Xlinker \
+	    -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
+
+$(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
+	$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@) \
+	  "(internalize)"
+	$(BCLinkLib) -o $(ObjDir)/$(LIBRARYNAME).o $(ObjectsBC)
+	$(Verb) $(LArchive) $@ $(ObjDir)/$(LIBRARYNAME).o
 else
-  ifdef EXPORTED_SYMBOL_FILE
-    BCLinkLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
-  else
-    BCLinkLib += -Xlinker -disable-internalize
-  endif
-endif
+$(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
+	$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
+	$(Verb) $(LArchive) $@ $(ObjectsBC)
 
-all-local:: $(LibName.BC)
-
-$(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
-	$(Echo) Linking $(BuildMode) Bytecode Library $(notdir $@)
-	$(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
+endif
 
 clean-local::
-ifneq ($(strip $(LibName.BC)),)
-	-$(Verb) $(RM) -f $(LibName.BC)
+ifneq ($(strip $(LibName.BCA)),)
+	-$(Verb) $(RM) -f $(LibName.BCA)
 endif
 
-DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
+DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
+
+install-bytecode: $(DestBytecodeLib)
 
 install-local:: $(DestBytecodeLib)
 
-$(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC) 
-	$(Echo) Installing $(BuildMode) Bytecode Library $(DestBytecodeLib)
-	$(Verb) $(INSTALL) $(LibName.BC) $@
+$(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA) 
+	$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
+	$(Verb) $(INSTALL) $(LibName.BCA) $@
 
 uninstall-local::
-	$(Echo) Uninstalling $(BuildMode) Bytecode Library $(DestBytecodeLib)
+	$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
 	-$(Verb) $(RM) -f $(DestBytecodeLib)
 
 endif






More information about the llvm-commits mailing list