[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.
authorLang Hames <lhames@gmail.com>
Mon, 8 Aug 2016 22:53:37 +0000 (22:53 +0000)
committerLang Hames <lhames@gmail.com>
Mon, 8 Aug 2016 22:53:37 +0000 (22:53 +0000)
commit33c0b6bfcaf7579ec552bf4688da33b41f12847a
treed1a0c09f6e1cb16896eebab4882cd054ac84b7d7
parent30a3d8e402626d275fd18a658324f7c5a14983d2
[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.

This patch causes RuntimeDyld to check for existing definitions when it
encounters weak symbols. If a definition already exists then the new weak
definition is discarded. All symbol lookups within a "logical dylib" should now
agree on the address of any given weak symbol. This allows the JIT to better
match the behavior of the static linker for C++ code.

This support is only partial, as it does not allow strong definitions that
occur after the first weak definition (in JIT symbol lookup order) to override
the previous weak definitions. Support for this will be added in a future
patch.

llvm-svn: 278065
llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
llvm/test/ExecutionEngine/MCJIT/Inputs/weak-function-2.ll [new file with mode: 0644]
llvm/test/ExecutionEngine/MCJIT/weak-function.ll [new file with mode: 0644]
llvm/test/ExecutionEngine/OrcMCJIT/Inputs/weak-function-2.ll [new file with mode: 0644]
llvm/test/ExecutionEngine/OrcMCJIT/weak-function.ll [new file with mode: 0644]