[lld] [llvm] [lld] Fix -ObjC load behavior with LTO for section names with whitespace (PR #146654)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 18 00:47:25 PDT 2025
================
@@ -293,10 +293,21 @@ static Expected<bool> hasObjCCategoryInModule(BitstreamCursor &Stream) {
std::string S;
if (convertToString(Record, 0, S))
return error("Invalid section name record");
+
// Check for the i386 and other (x86_64, ARM) conventions
- if (S.find("__DATA,__objc_catlist") != std::string::npos ||
- S.find("__OBJC,__category") != std::string::npos ||
- S.find("__TEXT,__swift") != std::string::npos)
+
+ SmallVector<StringRef, 2> SplitName;
+ StringRef(S).split(SplitName, ',');
+ if (SplitName.size() < 2)
+ break;
+ StringRef Segment = SplitName[0].trim();
+ StringRef Section = SplitName[1].trim();
----------------
aleksandr-urakov wrote:
AFAIU, there could be something like `__DATA,__objc_catlist,regular,no_dead_strip` (I'm not sure though). But we use `starts_with()` with `Section` everywhere, so I think your solution is good. Thank you!
https://github.com/llvm/llvm-project/pull/146654
More information about the llvm-commits
mailing list