This patch is enough to have shared objects recognized by LLDB. We can handle position independent executables. We can handle dynamically loaded modules brought in via dlopen. The DYLDRendezvous class provides an interface to a structure present in the address space of ELF-based processes. This structure provides the address of a function which is called by the linker each time a shared object is loaded and unloaded (thus a breakpoint at that address will let LLDB intercept such events), a list of entries describing the currently loaded shared objects, plus a few other things. On Linux, processes are brought up with an auxiliary vector on the stack. One element in this vector contains the (possibly dynamic) entry address of the process. One does not need to walk the stack to find this information as it is also available under /proc/<pid>/auxv. The new AuxVector class provides a convenient read-only view of this auxiliary vector information. We use the dynamic entry address and the address as specified in the object file to compute the actual load address of the inferior image. This strategy works for both normal executables and PIE's. llvm-svn: 123592
107 lines
3.3 KiB
Makefile
107 lines
3.3 KiB
Makefile
##===- source/Makefile -------------------------------------*- Makefile -*-===##
|
|
#
|
|
# The LLVM Compiler Infrastructure
|
|
#
|
|
# This file is distributed under the University of Illinois Open Source
|
|
# License. See LICENSE.TXT for details.
|
|
#
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
LEVEL := ../../..
|
|
LLDB_LEVEL := ..
|
|
|
|
LIBRARYNAME = lldb
|
|
|
|
#EXPORTED_SYMBOL_FILE = $(PROJ_SRC_DIR)/../resources/lldb-framework-exports
|
|
NO_BUILD_ARCHIVE = 1
|
|
LINK_LIBS_IN_SHARED = 1
|
|
SHARED_LIBRARY = 1
|
|
|
|
# Include all archives in liblldb.a files
|
|
USEDLIBS = lldbAPI.a \
|
|
lldbBreakpoint.a \
|
|
lldbCommands.a \
|
|
lldbCore.a \
|
|
lldbExpression.a \
|
|
lldbHostCommon.a \
|
|
lldbInitAndLog.a \
|
|
lldbInterpreter.a \
|
|
lldbPluginABIMacOSX_i386.a \
|
|
lldbPluginABISysV_x86_64.a \
|
|
lldbPluginDisassemblerLLVM.a \
|
|
lldbPluginObjectContainerBSDArchive.a \
|
|
lldbPluginObjectFileELF.a \
|
|
lldbPluginSymbolFileDWARF.a \
|
|
lldbPluginSymbolFileSymtab.a \
|
|
lldbPluginUtility.a \
|
|
lldbSymbol.a \
|
|
lldbTarget.a \
|
|
lldbUtility.a \
|
|
clangAnalysis.a \
|
|
clangAST.a \
|
|
clangBasic.a \
|
|
clangCodeGen.a \
|
|
clangFrontend.a \
|
|
clangDriver.a \
|
|
clangIndex.a \
|
|
clangLex.a \
|
|
clangRewrite.a \
|
|
clangParse.a \
|
|
clangSema.a \
|
|
clangSerialization.a \
|
|
EnhancedDisassembly.a \
|
|
clangChecker.a
|
|
|
|
include $(LLDB_LEVEL)/../../Makefile.config
|
|
|
|
LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \
|
|
ipo selectiondag jit mc
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
USEDLIBS += lldbHostMacOSX.a \
|
|
lldbPluginDynamicLoaderMacOSX.a \
|
|
lldbPluginObjectContainerUniversalMachO.a \
|
|
lldbPluginObjectFileMachO.a \
|
|
lldbPluginProcessGDBRemote.a \
|
|
lldbPluginSymbolVendorMacOSX.a
|
|
endif
|
|
|
|
ifeq ($(HOST_OS),Linux)
|
|
USEDLIBS += lldbPluginProcessLinux.a \
|
|
lldbPluginDynamicLoaderLinux.a
|
|
endif
|
|
|
|
include $(LEVEL)/Makefile.common
|
|
|
|
ifeq ($(HOST_OS),Darwin)
|
|
LLVMLibsOptions += -Wl,-all_load
|
|
# set dylib internal version number to llvmCore submission number
|
|
ifdef LLDB_SUBMIT_VERSION
|
|
LLVMLibsOptions += -Wl,-current_version \
|
|
-Wl,$(LLDB_SUBMIT_VERSION).$(LLDB_SUBMIT_SUBVERSION) \
|
|
-Wl,-compatibility_version -Wl,1
|
|
endif
|
|
# extra options to override libtool defaults
|
|
LLVMLibsOptions += -avoid-version
|
|
LLVMLibsOptions += -F/System/Library/Frameworks -F/System/Library/PrivateFrameworks
|
|
LLVMLibsOptions += -framework Foundation -framework CoreFoundation
|
|
LLVMLibsOptions += -framework DebugSymbols -lpython2.6 -lobjc
|
|
LLVMLibsOptions += -Wl,-exported_symbols_list -Wl,"$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/resources/lldb-framework-exports"
|
|
# Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
|
|
DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
|
|
ifneq ($(DARWIN_VERS),8)
|
|
LLVMLibsOptions += -no-undefined -Wl,-install_name \
|
|
-Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(HOST_OS), Linux)
|
|
# Include everything from the .a's into the shared library.
|
|
ProjLibsOptions := -Wl,--whole-archive $(ProjLibsOptions) \
|
|
-Wl,--no-whole-archive
|
|
# Don't allow unresolved symbols.
|
|
LLVMLibsOptions += -Wl,--no-undefined
|
|
# Link in python
|
|
LD.Flags += -lpython2.6
|
|
endif
|