mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-30 04:35:00 +00:00
For 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18425 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3298f87c0b
commit
9a2f137765
@ -232,8 +232,8 @@ ifdef TOOL_VERBOSE
|
|||||||
C.Flags += -v
|
C.Flags += -v
|
||||||
CXX.Flags += -v
|
CXX.Flags += -v
|
||||||
LD.Flags += -v
|
LD.Flags += -v
|
||||||
BCLinkLib.Flags += -v
|
|
||||||
VERBOSE := 1
|
VERBOSE := 1
|
||||||
|
else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Adjust settings for verbose mode
|
# Adjust settings for verbose mode
|
||||||
@ -286,12 +286,11 @@ Link = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
|||||||
$(CompileCommonOpts) $(LD.Flags) $(Strip)
|
$(CompileCommonOpts) $(LD.Flags) $(Strip)
|
||||||
Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
Relink = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
|
||||||
$(CompileCommonOpts)
|
$(CompileCommonOpts)
|
||||||
BCLinkLib = $(LLVMGCC) -shared -nostdlib $(BCLinkLib.Flags)
|
|
||||||
LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
|
LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL)
|
||||||
Burg = $(BURG) -I $(BUILD_SRC_DIR)
|
Burg = $(BURG) -I $(BUILD_SRC_DIR)
|
||||||
TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
|
TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
|
||||||
Archive = $(AR) $(AR.Flags)
|
Archive = $(AR) $(AR.Flags)
|
||||||
LArchive = $(ToolDir)/llvm-ar rcsf
|
LArchive = $(LLVMToolDir)/llvm-ar rcsf
|
||||||
ifdef RANLIB
|
ifdef RANLIB
|
||||||
Ranlib = $(RANLIB)
|
Ranlib = $(RANLIB)
|
||||||
else
|
else
|
||||||
@ -466,7 +465,7 @@ LIBRARYNAME := $(strip $(LIBRARYNAME))
|
|||||||
LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
|
LibName.LA := $(LibDir)/lib$(LIBRARYNAME).la
|
||||||
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
|
LibName.A := $(LibDir)/lib$(LIBRARYNAME).a
|
||||||
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
LibName.O := $(LibDir)/$(LIBRARYNAME).o
|
||||||
LibName.BC := $(LibDir)/lib$(LIBRARYNAME).bc
|
LibName.BCA:= $(LibDir)/lib$(LIBRARYNAME).bca
|
||||||
|
|
||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
# Shared Library Targets:
|
# Shared Library Targets:
|
||||||
@ -511,37 +510,41 @@ endif
|
|||||||
#---------------------------------------------------------
|
#---------------------------------------------------------
|
||||||
ifdef BYTECODE_LIBRARY
|
ifdef BYTECODE_LIBRARY
|
||||||
|
|
||||||
ifdef EXPORTED_SYMBOL_LIST
|
all-local:: $(LibName.BCA)
|
||||||
BCLinkLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
|
|
||||||
|
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
|
else
|
||||||
ifdef EXPORTED_SYMBOL_FILE
|
$(LibName.BCA): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
|
||||||
BCLinkLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
|
$(Echo) Building $(BuildMode) Bytecode Archive $(notdir $@)
|
||||||
else
|
$(Verb) $(LArchive) $@ $(ObjectsBC)
|
||||||
BCLinkLib += -Xlinker -disable-internalize
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all-local:: $(LibName.BC)
|
|
||||||
|
|
||||||
$(LibName.BC): $(BUILT_SOURCES) $(ObjectsBC) $(LibDir)/.dir $(GCCLD)
|
|
||||||
$(Echo) Linking $(BuildMode) Bytecode Library $(notdir $@)
|
|
||||||
$(Verb) $(BCLinkLib) -o $@ $(ObjectsBC)
|
|
||||||
|
|
||||||
clean-local::
|
clean-local::
|
||||||
ifneq ($(strip $(LibName.BC)),)
|
ifneq ($(strip $(LibName.BCA)),)
|
||||||
-$(Verb) $(RM) -f $(LibName.BC)
|
-$(Verb) $(RM) -f $(LibName.BCA)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).bc
|
DestBytecodeLib = $(bytecode_libdir)/lib$(LIBRARYNAME).a
|
||||||
|
|
||||||
|
install-bytecode: $(DestBytecodeLib)
|
||||||
|
|
||||||
install-local:: $(DestBytecodeLib)
|
install-local:: $(DestBytecodeLib)
|
||||||
|
|
||||||
$(DestBytecodeLib): $(bytecode_libdir) $(LibName.BC)
|
$(DestBytecodeLib): $(bytecode_libdir) $(LibName.BCA)
|
||||||
$(Echo) Installing $(BuildMode) Bytecode Library $(DestBytecodeLib)
|
$(Echo) Installing $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
||||||
$(Verb) $(INSTALL) $(LibName.BC) $@
|
$(Verb) $(INSTALL) $(LibName.BCA) $@
|
||||||
|
|
||||||
uninstall-local::
|
uninstall-local::
|
||||||
$(Echo) Uninstalling $(BuildMode) Bytecode Library $(DestBytecodeLib)
|
$(Echo) Uninstalling $(BuildMode) Bytecode Archive $(DestBytecodeLib)
|
||||||
-$(Verb) $(RM) -f $(DestBytecodeLib)
|
-$(Verb) $(RM) -f $(DestBytecodeLib)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user