[compiler-rt] [llvm] [ORC][Runtime] Add `dlupdate` for MachO (PR #97441)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 00:13:29 PDT 2024


================
@@ -611,9 +612,22 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
   auto &ES = J.getExecutionSession();
   auto MainSearchOrder = J.getMainJITDylib().withLinkOrderDo(
       [](const JITDylibSearchOrder &SO) { return SO; });
+  StringRef WrapperToCall = "__orc_rt_jit_dlopen_wrapper";
+  bool dlupdate = false;
+  if (ES.getTargetTriple().isOSBinFormatMachO()) {
+    if (InitializedDylib.contains(&JD)) {
+      WrapperToCall = "__orc_rt_jit_dlupdate_wrapper";
+      dlupdate = true;
+    } else
+      InitializedDylib.insert(&JD);
----------------
lhames wrote:

`deinitialize` should take the JITDylib back out of the set, since the following sequence is valid:
1. initialize.
2. deinitialize.
3. initialize.

Longer term we should probably rethink these operations on `LLJIT`, but for now this is a good compromise.

https://github.com/llvm/llvm-project/pull/97441


More information about the llvm-commits mailing list