[compiler-rt] 5f9e6c8 - [Orc][Runtime] Refactor `dlupdate` to remove the `mode` argument (#110491)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 16 15:42:05 PDT 2024
Author: SahilPatidar
Date: 2024-10-17T09:42:01+11:00
New Revision: 5f9e6c811ba64e5d86e01f4df3995776c8090254
URL: https://github.com/llvm/llvm-project/commit/5f9e6c811ba64e5d86e01f4df3995776c8090254
DIFF: https://github.com/llvm/llvm-project/commit/5f9e6c811ba64e5d86e01f4df3995776c8090254.diff
LOG: [Orc][Runtime] Refactor `dlupdate` to remove the `mode` argument (#110491)
Added:
Modified:
compiler-rt/lib/orc/dlfcn_wrapper.cpp
compiler-rt/lib/orc/macho_platform.cpp
compiler-rt/lib/orc/macho_platform.h
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/orc/dlfcn_wrapper.cpp b/compiler-rt/lib/orc/dlfcn_wrapper.cpp
index bbbc79f607f270..dec8d1e5bbc31e 100644
--- a/compiler-rt/lib/orc/dlfcn_wrapper.cpp
+++ b/compiler-rt/lib/orc/dlfcn_wrapper.cpp
@@ -20,7 +20,7 @@ using namespace orc_rt;
extern "C" const char *__orc_rt_jit_dlerror();
extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
-extern "C" int __orc_rt_jit_dlupdate(void *dso_handle, int mode);
+extern "C" int __orc_rt_jit_dlupdate(void *dso_handle);
extern "C" int __orc_rt_jit_dlclose(void *dso_handle);
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
@@ -45,10 +45,10 @@ __orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
#ifdef __APPLE__
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
__orc_rt_jit_dlupdate_wrapper(const char *ArgData, size_t ArgSize) {
- return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
+ return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
ArgData, ArgSize,
- [](ExecutorAddr &DSOHandle, int32_t mode) {
- return __orc_rt_jit_dlupdate(DSOHandle.toPtr<void *>(), mode);
+ [](ExecutorAddr &DSOHandle) {
+ return __orc_rt_jit_dlupdate(DSOHandle.toPtr<void *>());
})
.release();
}
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index afd90c791ae135..8ca68587aeb363 100644
--- a/compiler-rt/lib/orc/macho_platform.cpp
+++ b/compiler-rt/lib/orc/macho_platform.cpp
@@ -245,7 +245,7 @@ class MachOPlatformRuntimeState {
const char *dlerror();
void *dlopen(std::string_view Name, int Mode);
- int dlupdate(void *DSOHandle, int Mode);
+ int dlupdate(void *DSOHandle);
int dlclose(void *DSOHandle);
void *dlsym(void *DSOHandle, const char *Symbol);
@@ -295,7 +295,7 @@ class MachOPlatformRuntimeState {
Error dlopenInitialize(std::unique_lock<std::mutex> &JDStatesLock,
JITDylibState &JDS, MachOJITDylibDepInfoMap &DepInfo);
- Error dlupdateImpl(void *DSOHandle, int Mode);
+ Error dlupdateImpl(void *DSOHandle);
Error dlupdateFull(std::unique_lock<std::mutex> &JDStatesLock,
JITDylibState &JDS);
Error dlupdateInitialize(std::unique_lock<std::mutex> &JDStatesLock,
@@ -710,13 +710,13 @@ void *MachOPlatformRuntimeState::dlopen(std::string_view Path, int Mode) {
}
}
-int MachOPlatformRuntimeState::dlupdate(void *DSOHandle, int Mode) {
+int MachOPlatformRuntimeState::dlupdate(void *DSOHandle) {
ORC_RT_DEBUG({
std::string S;
printdbg("MachOPlatform::dlupdate(%p) (%s)\n", DSOHandle, S.c_str());
});
std::lock_guard<std::recursive_mutex> Lock(DyldAPIMutex);
- if (auto Err = dlupdateImpl(DSOHandle, Mode)) {
+ if (auto Err = dlupdateImpl(DSOHandle)) {
// FIXME: Make dlerror thread safe.
DLFcnError = toString(std::move(Err));
return -1;
@@ -1179,7 +1179,7 @@ Error MachOPlatformRuntimeState::dlopenInitialize(
return Error::success();
}
-Error MachOPlatformRuntimeState::dlupdateImpl(void *DSOHandle, int Mode) {
+Error MachOPlatformRuntimeState::dlupdateImpl(void *DSOHandle) {
std::unique_lock<std::mutex> Lock(JDStatesMutex);
// Try to find JITDylib state by DSOHandle.
@@ -1513,8 +1513,8 @@ void *__orc_rt_macho_jit_dlopen(const char *path, int mode) {
return MachOPlatformRuntimeState::get().dlopen(path, mode);
}
-int __orc_rt_macho_jit_dlupdate(void *dso_handle, int mode) {
- return MachOPlatformRuntimeState::get().dlupdate(dso_handle, mode);
+int __orc_rt_macho_jit_dlupdate(void *dso_handle) {
+ return MachOPlatformRuntimeState::get().dlupdate(dso_handle);
}
int __orc_rt_macho_jit_dlclose(void *dso_handle) {
diff --git a/compiler-rt/lib/orc/macho_platform.h b/compiler-rt/lib/orc/macho_platform.h
index ad70c97809d2f6..aeab248f7f8ae4 100644
--- a/compiler-rt/lib/orc/macho_platform.h
+++ b/compiler-rt/lib/orc/macho_platform.h
@@ -24,7 +24,7 @@ ORC_RT_INTERFACE void __orc_rt_macho_cxa_finalize(void *dso_handle);
// dlfcn functions.
ORC_RT_INTERFACE const char *__orc_rt_macho_jit_dlerror();
ORC_RT_INTERFACE void *__orc_rt_macho_jit_dlopen(const char *path, int mode);
-ORC_RT_INTERFACE int __orc_rt_macho_jit_dlupdate(void *dso_handle, int mode);
+ORC_RT_INTERFACE int __orc_rt_macho_jit_dlupdate(void *dso_handle);
ORC_RT_INTERFACE int __orc_rt_macho_jit_dlclose(void *dso_handle);
ORC_RT_INTERFACE void *__orc_rt_macho_jit_dlsym(void *dso_handle,
const char *symbol);
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index c56ec196772b38..401ed525fd5cfe 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -608,7 +608,7 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
using llvm::orc::shared::SPSExecutorAddr;
using llvm::orc::shared::SPSString;
using SPSDLOpenSig = SPSExecutorAddr(SPSString, int32_t);
- using SPSDLUpdateSig = int32_t(SPSExecutorAddr, int32_t);
+ using SPSDLUpdateSig = int32_t(SPSExecutorAddr);
enum dlopen_mode : int32_t {
ORC_RT_RTLD_LAZY = 0x1,
ORC_RT_RTLD_NOW = 0x2,
@@ -634,8 +634,7 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
if (dlupdate) {
int32_t result;
auto E = ES.callSPSWrapper<SPSDLUpdateSig>(WrapperAddr->getAddress(),
- result, DSOHandles[&JD],
- int32_t(ORC_RT_RTLD_LAZY));
+ result, DSOHandles[&JD]);
if (E)
return E;
else if (result)
More information about the llvm-commits
mailing list