From: Lang Hames Date: Mon, 17 Apr 2023 20:40:42 +0000 (-0700) Subject: [ORC-RT] Don't check for objc image registration functions unless needed. X-Git-Tag: upstream/17.0.6~11298 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61d535ac3603026ef8fbf0f1bf7b5e9e05981ca0;p=platform%2Fupstream%2Fllvm.git [ORC-RT] Don't check for objc image registration functions unless needed. If we don't have any ObjC metadata to register we shouldn't require these symbols to be available. --- diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp index 33f7fbb..cb248aa 100644 --- a/compiler-rt/lib/orc/macho_platform.cpp +++ b/compiler-rt/lib/orc/macho_platform.cpp @@ -861,15 +861,18 @@ Error MachOPlatformRuntimeState::registerObjCRegistrationObjects( JITDylibState &JDS) { ORC_RT_DEBUG(printdbg("Registering Objective-C / Swift metadata.\n")); + std::vector RegObjBases; + JDS.ObjCRuntimeRegistrationObjects.processNewSections( + [&](span RegObj) { RegObjBases.push_back(RegObj.data()); }); + + if (RegObjBases.empty()) + return Error::success(); + if (!_objc_map_images || !_objc_load_image) return make_error( "Could not register Objective-C / Swift metadata: _objc_map_images / " "_objc_load_image not found"); - std::vector RegObjBases; - JDS.ObjCRuntimeRegistrationObjects.processNewSections( - [&](span RegObj) { RegObjBases.push_back(RegObj.data()); }); - std::vector Paths; Paths.resize(RegObjBases.size()); _objc_map_images(RegObjBases.size(), Paths.data(),