llvm-project/lldb/source/Expression
Pavel Labath d739636ccf Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB"
This commit really did not introduce any functional changes (for most
people) but it turns out it's not for the reason we thought it was.

The reason wasn't that Orc is a perfect drop-in replacement for MCJIT,
but it was because we were never using Orc in the first place, as it was
not initialized.

Orc's initialization relies on a global constructor in the LLVMOrcJIT.a.
Since this archive does not expose any symbols referenced from other
object files, it does not get linked into liblldb when linking against
llvm components statically. However, in an LLVM_LINK_LLVM_DYLIB=On
build, LLVMOrcJit.a is linked into libLLVM.so using --whole-archive, so
the global constructor does end up firing.

The result of using Orc jit is pr34194, where lldb fails to evaluate
even very simple expressions. This bug can be reproduced in
non-LLVM_LINK_LLVM_DYLIB builds by making sure Orc jit is linked into
liblldb, for example by #including
llvm/ExecutionEngine/OrcMCJITReplacement.h in IRExecutionUnit.cpp (and
adding OrcJIT as a dependency to the relevant CMakeLists.txt file). The
bug reproduces (at least) on linux and osx.

The root cause of the bug seems to be related to relocation processing.
It seems Orc processes relocations earlier than the system it is
replacing. This means the relocation processing happens before we have
had a chance to remap section load addresses to reflect their address in
the target process memory, so they end up pointing to locations in the
lldb's address space instead.

I am not sure whether this is a bug in Orc jit, or in how we are using
it from lldb, but in any case it is preventing us from using Orc right
now. Reverting this fixes LLVM_LINK_LLVM_DYLIB build, and makes it clear
that we are in fact *not* using Orc, and we never really were.

This reverts commit r279327.

llvm-svn: 318039
2017-11-13 14:03:17 +00:00
..
CMakeLists.txt Revert r298776 - Expression: add missing linkage to RuntimeDyld ... 2017-03-30 18:24:07 +00:00
DWARFExpression.cpp Remove the DWARFExpression -> Clang ExpressionParser dependency 2017-08-16 11:45:10 +00:00
DiagnosticManager.cpp Add CopyDiagnostic to the DiagnosticManager. 2017-04-19 18:56:44 +00:00
Expression.cpp [lldb] Fix typos in file headers 2016-11-26 05:23:44 +00:00
ExpressionSourceCode.cpp Move classes from Core -> Utility. 2017-02-02 21:39:50 +00:00
ExpressionVariable.cpp Move Log from Core -> Utility. 2017-03-03 20:56:28 +00:00
FunctionCaller.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
IRDynamicChecks.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
IRExecutionUnit.cpp Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB" 2017-11-13 14:03:17 +00:00
IRInterpreter.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
IRMemoryMap.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
LLVMUserExpression.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
Materializer.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
REPL.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
UserExpression.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
UtilityFunction.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00