@@ -110,7 +110,7 @@ class COFFPlatformRuntimeState {
110110
111111 const char *dlerror ();
112112 void *dlopen (std::string_view Name, int Mode);
113- void * dlupdate (void *DSOHandle, int Mode);
113+ int dlupdate (void *DSOHandle, int Mode);
114114 int dlclose (void *Header);
115115 void *dlsym (void *Header, std::string_view Symbol);
116116
@@ -142,7 +142,7 @@ class COFFPlatformRuntimeState {
142142 Error dlopenFull (JITDylibState &JDS);
143143 Error dlopenInitialize (JITDylibState &JDS, COFFJITDylibDepInfoMap &DepInfo);
144144
145- Expected< void *> dlupdateImpl (void *DSOHandle, int Mode);
145+ Error dlupdateImpl (void *DSOHandle, int Mode);
146146 Error dlupdateFull (JITDylibState &JDS);
147147 Error dlupdateInitialize (JITDylibState &JDS);
148148
@@ -270,19 +270,18 @@ void *COFFPlatformRuntimeState::dlopen(std::string_view Path, int Mode) {
270270 }
271271}
272272
273- void * COFFPlatformRuntimeState::dlupdate (void *DSOHandle, int Mode) {
273+ int COFFPlatformRuntimeState::dlupdate (void *DSOHandle, int Mode) {
274274 ORC_RT_DEBUG ({
275275 std::string S;
276276 printdbg (" COFFPlatform::dlupdate(%p) (%s)\n " , DSOHandle, S.c_str ());
277277 });
278278 std::lock_guard<std::recursive_mutex> Lock (JDStatesMutex);
279- if (auto H = dlupdateImpl (DSOHandle, Mode))
280- return *H;
281- else {
279+ if (auto Err = dlupdateImpl (DSOHandle, Mode)) {
282280 // FIXME: Make dlerror thread safe.
283- DLFcnError = toString (H. takeError ( ));
284- return nullptr ;
281+ DLFcnError = toString (std::move (Err ));
282+ return - 1 ;
285283 }
284+ return 0 ;
286285}
287286
288287int COFFPlatformRuntimeState::dlclose (void *DSOHandle) {
@@ -410,8 +409,7 @@ Error COFFPlatformRuntimeState::dlopenInitialize(
410409 return Error::success ();
411410}
412411
413- Expected<void *> COFFPlatformRuntimeState::dlupdateImpl (void *DSOHandle,
414- int Mode) {
412+ Error COFFPlatformRuntimeState::dlupdateImpl (void *DSOHandle, int Mode) {
415413 // Try to find JITDylib state by name.
416414 auto *JDS = getJITDylibStateByHeader (DSOHandle);
417415
@@ -425,10 +423,9 @@ Expected<void *> COFFPlatformRuntimeState::dlupdateImpl(void *DSOHandle,
425423 return make_error<StringError>(" dlupdate failed, JITDylib must be open." );
426424
427425 if (auto Err = dlupdateFull (*JDS))
428- return std::move ( Err) ;
426+ return Err;
429427
430- // Return the header address.
431- return JDS->Header ;
428+ return Error::success ();
432429}
433430
434431Error COFFPlatformRuntimeState::dlupdateFull (JITDylibState &JDS) {
@@ -738,7 +735,7 @@ void *__orc_rt_coff_jit_dlopen(const char *path, int mode) {
738735 return COFFPlatformRuntimeState::get ().dlopen (path, mode);
739736}
740737
741- void * __orc_rt_coff_jit_dlupdate (void *dso_handle, int mode) {
738+ int __orc_rt_coff_jit_dlupdate (void *dso_handle, int mode) {
742739 return COFFPlatformRuntimeState::get ().dlupdate (dso_handle, mode);
743740}
744741
0 commit comments