mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-19 07:46:49 +00:00
[Orc][Runtime] Refactor dlupdate
to remove the mode
argument (#110491)
This commit is contained in:
parent
a24c468782
commit
5f9e6c811b
@ -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();
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public:
|
||||
|
||||
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 @@ private:
|
||||
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) {
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user