Skip to content

Commit 5f9e6c8

Browse files
authored
[Orc][Runtime] Refactor dlupdate to remove the mode argument (#110491)
1 parent a24c468 commit 5f9e6c8

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

compiler-rt/lib/orc/dlfcn_wrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ using namespace orc_rt;
2020

2121
extern "C" const char *__orc_rt_jit_dlerror();
2222
extern "C" void *__orc_rt_jit_dlopen(const char *path, int mode);
23-
extern "C" int __orc_rt_jit_dlupdate(void *dso_handle, int mode);
23+
extern "C" int __orc_rt_jit_dlupdate(void *dso_handle);
2424
extern "C" int __orc_rt_jit_dlclose(void *dso_handle);
2525

2626
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
@@ -45,10 +45,10 @@ __orc_rt_jit_dlopen_wrapper(const char *ArgData, size_t ArgSize) {
4545
#ifdef __APPLE__
4646
ORC_RT_INTERFACE orc_rt_CWrapperFunctionResult
4747
__orc_rt_jit_dlupdate_wrapper(const char *ArgData, size_t ArgSize) {
48-
return WrapperFunction<int32_t(SPSExecutorAddr, int32_t)>::handle(
48+
return WrapperFunction<int32_t(SPSExecutorAddr)>::handle(
4949
ArgData, ArgSize,
50-
[](ExecutorAddr &DSOHandle, int32_t mode) {
51-
return __orc_rt_jit_dlupdate(DSOHandle.toPtr<void *>(), mode);
50+
[](ExecutorAddr &DSOHandle) {
51+
return __orc_rt_jit_dlupdate(DSOHandle.toPtr<void *>());
5252
})
5353
.release();
5454
}

compiler-rt/lib/orc/macho_platform.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class MachOPlatformRuntimeState {
245245

246246
const char *dlerror();
247247
void *dlopen(std::string_view Name, int Mode);
248-
int dlupdate(void *DSOHandle, int Mode);
248+
int dlupdate(void *DSOHandle);
249249
int dlclose(void *DSOHandle);
250250
void *dlsym(void *DSOHandle, const char *Symbol);
251251

@@ -295,7 +295,7 @@ class MachOPlatformRuntimeState {
295295
Error dlopenInitialize(std::unique_lock<std::mutex> &JDStatesLock,
296296
JITDylibState &JDS, MachOJITDylibDepInfoMap &DepInfo);
297297

298-
Error dlupdateImpl(void *DSOHandle, int Mode);
298+
Error dlupdateImpl(void *DSOHandle);
299299
Error dlupdateFull(std::unique_lock<std::mutex> &JDStatesLock,
300300
JITDylibState &JDS);
301301
Error dlupdateInitialize(std::unique_lock<std::mutex> &JDStatesLock,
@@ -710,13 +710,13 @@ void *MachOPlatformRuntimeState::dlopen(std::string_view Path, int Mode) {
710710
}
711711
}
712712

713-
int MachOPlatformRuntimeState::dlupdate(void *DSOHandle, int Mode) {
713+
int MachOPlatformRuntimeState::dlupdate(void *DSOHandle) {
714714
ORC_RT_DEBUG({
715715
std::string S;
716716
printdbg("MachOPlatform::dlupdate(%p) (%s)\n", DSOHandle, S.c_str());
717717
});
718718
std::lock_guard<std::recursive_mutex> Lock(DyldAPIMutex);
719-
if (auto Err = dlupdateImpl(DSOHandle, Mode)) {
719+
if (auto Err = dlupdateImpl(DSOHandle)) {
720720
// FIXME: Make dlerror thread safe.
721721
DLFcnError = toString(std::move(Err));
722722
return -1;
@@ -1179,7 +1179,7 @@ Error MachOPlatformRuntimeState::dlopenInitialize(
11791179
return Error::success();
11801180
}
11811181

1182-
Error MachOPlatformRuntimeState::dlupdateImpl(void *DSOHandle, int Mode) {
1182+
Error MachOPlatformRuntimeState::dlupdateImpl(void *DSOHandle) {
11831183
std::unique_lock<std::mutex> Lock(JDStatesMutex);
11841184

11851185
// Try to find JITDylib state by DSOHandle.
@@ -1513,8 +1513,8 @@ void *__orc_rt_macho_jit_dlopen(const char *path, int mode) {
15131513
return MachOPlatformRuntimeState::get().dlopen(path, mode);
15141514
}
15151515

1516-
int __orc_rt_macho_jit_dlupdate(void *dso_handle, int mode) {
1517-
return MachOPlatformRuntimeState::get().dlupdate(dso_handle, mode);
1516+
int __orc_rt_macho_jit_dlupdate(void *dso_handle) {
1517+
return MachOPlatformRuntimeState::get().dlupdate(dso_handle);
15181518
}
15191519

15201520
int __orc_rt_macho_jit_dlclose(void *dso_handle) {

compiler-rt/lib/orc/macho_platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ORC_RT_INTERFACE void __orc_rt_macho_cxa_finalize(void *dso_handle);
2424
// dlfcn functions.
2525
ORC_RT_INTERFACE const char *__orc_rt_macho_jit_dlerror();
2626
ORC_RT_INTERFACE void *__orc_rt_macho_jit_dlopen(const char *path, int mode);
27-
ORC_RT_INTERFACE int __orc_rt_macho_jit_dlupdate(void *dso_handle, int mode);
27+
ORC_RT_INTERFACE int __orc_rt_macho_jit_dlupdate(void *dso_handle);
2828
ORC_RT_INTERFACE int __orc_rt_macho_jit_dlclose(void *dso_handle);
2929
ORC_RT_INTERFACE void *__orc_rt_macho_jit_dlsym(void *dso_handle,
3030
const char *symbol);

llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
608608
using llvm::orc::shared::SPSExecutorAddr;
609609
using llvm::orc::shared::SPSString;
610610
using SPSDLOpenSig = SPSExecutorAddr(SPSString, int32_t);
611-
using SPSDLUpdateSig = int32_t(SPSExecutorAddr, int32_t);
611+
using SPSDLUpdateSig = int32_t(SPSExecutorAddr);
612612
enum dlopen_mode : int32_t {
613613
ORC_RT_RTLD_LAZY = 0x1,
614614
ORC_RT_RTLD_NOW = 0x2,
@@ -634,8 +634,7 @@ Error ORCPlatformSupport::initialize(orc::JITDylib &JD) {
634634
if (dlupdate) {
635635
int32_t result;
636636
auto E = ES.callSPSWrapper<SPSDLUpdateSig>(WrapperAddr->getAddress(),
637-
result, DSOHandles[&JD],
638-
int32_t(ORC_RT_RTLD_LAZY));
637+
result, DSOHandles[&JD]);
639638
if (E)
640639
return E;
641640
else if (result)

0 commit comments

Comments
 (0)