[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.
authorLang Hames <lhames@gmail.com>
Sun, 2 Aug 2020 00:44:34 +0000 (17:44 -0700)
committerLang Hames <lhames@gmail.com>
Sun, 2 Aug 2020 01:33:44 +0000 (18:33 -0700)
commit0f5b70769d15d8cc728dcba353a33fb459450381
tree820ffe7301e7411da34abfb476a4884e99e37263
parente12a028ed3ed79fba1e1aa5212c7e22d83949192
[llvm-jitlink] Add -phony-externals option to suppress unresolved externals.

The -phony-externals option adds a generator which explicitly defines any
otherwise unresolved externals as null. This transforms link-time
unresolved-symbol errors into potential runtime null pointer accesses
(if an unresolved external is actually accessed during execution).

This option can be useful in -harness mode to avoid having to mock a
large number of symbols that are not reachable at runtime (e.g. unused
methods referenced by a class vtable).
llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
llvm/test/ExecutionEngine/JITLink/X86/Inputs/MachO_test_harness_test.s
llvm/test/ExecutionEngine/JITLink/X86/MachO_test_harness_harness.s
llvm/tools/llvm-jitlink/llvm-jitlink.cpp