[PATCH] D125250: [lld/macho] Fixes the -ObjC flag
Tapan Thaker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 11:26:22 PDT 2022
tt created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
tt requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When checking the segment name for Swift symbols, we should be checking that they start with `__swift` instead of checking for equality
Fixes the issue https://github.com/llvm/llvm-project/issues/55355
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125250
Files:
lld/MachO/ObjC.cpp
Index: lld/MachO/ObjC.cpp
===================================================================
--- lld/MachO/ObjC.cpp
+++ lld/MachO/ObjC.cpp
@@ -37,10 +37,15 @@
strnlen(secHead.sectname, sizeof(secHead.sectname)));
StringRef segname(secHead.segname,
strnlen(secHead.segname, sizeof(secHead.segname)));
+
+ const StringRef swiftSectName(
+ section_names::swift,
+ strnlen(section_names::swift, sizeof(section_names::swift)));
+
if ((segname == segment_names::data &&
sectname == section_names::objcCatList) ||
(segname == segment_names::text &&
- sectname == section_names::swift)) {
+ sectname.startswith(swiftSectName))) {
return true;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125250.428138.patch
Type: text/x-patch
Size: 792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220509/a816c54a/attachment.bin>
More information about the llvm-commits
mailing list