[lld] [llvm] [lld] Fix -ObjC load behavior with LTO for section names with whitespace (PR #146654)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 11 14:53:38 PDT 2025
================
@@ -296,7 +296,8 @@ static Expected<bool> hasObjCCategoryInModule(BitstreamCursor &Stream) {
// 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)
+ S.find("__TEXT,__swift") != std::string::npos ||
+ S.find("__TEXT, __swift") != std::string::npos)
----------------
kyulee-com wrote:
It's unfortunate that the Swift compiler inconsistently prefixes an empty space to the section name. While one option is to fix the Swift compiler, there might be a reason for this behavior. Regardless, I would like to achieve more reliable results by explicitly parsing the segment and section names. It seems we already handle this case in the [LLVM project](https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCSectionMachO.cpp#L195-L196). Can we do a similar approach here?
https://github.com/llvm/llvm-project/pull/146654
More information about the llvm-commits
mailing list