[compiler-rt] 61d535a - [ORC-RT] Don't check for objc image registration functions unless needed.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 13:51:40 PDT 2023
Author: Lang Hames
Date: 2023-04-17T13:51:33-07:00
New Revision: 61d535ac3603026ef8fbf0f1bf7b5e9e05981ca0
URL: https://github.com/llvm/llvm-project/commit/61d535ac3603026ef8fbf0f1bf7b5e9e05981ca0
DIFF: https://github.com/llvm/llvm-project/commit/61d535ac3603026ef8fbf0f1bf7b5e9e05981ca0.diff
LOG: [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.
Added:
Modified:
compiler-rt/lib/orc/macho_platform.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index 33f7fbb8b347c..cb248aae06660 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<char *> RegObjBases;
+ JDS.ObjCRuntimeRegistrationObjects.processNewSections(
+ [&](span<char> RegObj) { RegObjBases.push_back(RegObj.data()); });
+
+ if (RegObjBases.empty())
+ return Error::success();
+
if (!_objc_map_images || !_objc_load_image)
return make_error<StringError>(
"Could not register Objective-C / Swift metadata: _objc_map_images / "
"_objc_load_image not found");
- std::vector<char *> RegObjBases;
- JDS.ObjCRuntimeRegistrationObjects.processNewSections(
- [&](span<char> RegObj) { RegObjBases.push_back(RegObj.data()); });
-
std::vector<char *> Paths;
Paths.resize(RegObjBases.size());
_objc_map_images(RegObjBases.size(), Paths.data(),
More information about the llvm-commits
mailing list