[llvm] adbc7a2 - [llvm-jitlink] Don't add process symbols to every JITDylib.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 7 21:29:20 PST 2022
Author: Lang Hames
Date: 2022-02-08T16:18:43+11:00
New Revision: adbc7a2665768d54a7b35e8d9e5d4a02dee6de6d
URL: https://github.com/llvm/llvm-project/commit/adbc7a2665768d54a7b35e8d9e5d4a02dee6de6d
DIFF: https://github.com/llvm/llvm-project/commit/adbc7a2665768d54a7b35e8d9e5d4a02dee6de6d.diff
LOG: [llvm-jitlink] Don't add process symbols to every JITDylib.
The addProcessSymbols function added a generator for process symbols to every
JITDylib in the session, but this is unhelpful default behavior (e.g. it will
cause the ORC runtime's definition of __cxa_atexit to be shadowed by the
process's definition for all JITDylibs except main).
Since the loadProcessSymbols function already added a generator to main we only
need to drop this function. Other JITDylibs wishing to resolve process symbols
can link against the main JITDylib by passing `-lmain`.
Added:
Modified:
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 3dc17677c0a8a..580ebda97cab5 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1718,21 +1718,6 @@ static Error addLibraries(Session &S,
return Error::success();
}
-static Error addProcessSymbols(Session &S,
- const std::map<unsigned, JITDylib *> &IdxToJD) {
-
- if (NoProcessSymbols)
- return Error::success();
-
- for (auto &KV : IdxToJD) {
- auto &JD = *KV.second;
- JD.addGenerator(ExitOnErr(
- orc::EPCDynamicLibrarySearchGenerator::GetForTargetProcess(S.ES)));
- }
-
- return Error::success();
-}
-
static Error addSessionInputs(Session &S) {
std::map<unsigned, JITDylib *> IdxToJD;
@@ -1755,9 +1740,6 @@ static Error addSessionInputs(Session &S) {
if (auto Err = addLibraries(S, IdxToJD))
return Err;
- if (auto Err = addProcessSymbols(S, IdxToJD))
- return Err;
-
return Error::success();
}
More information about the llvm-commits
mailing list