[llvm-branch-commits] [lld] [lld][MachO] Support Objective-C class stubs (PR #219744)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Sep 1 17:56:27 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- lld/MachO/Arch/ARM64.cpp lld/MachO/Driver.cpp lld/MachO/MarkLive.cpp lld/MachO/SyntheticSections.cpp lld/MachO/SyntheticSections.h lld/MachO/Target.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 6ad9a7a04..87393c016 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -1630,9 +1630,9 @@ static void prepareObjCStubs() {
Symbol *classSym = symtab->find(parsed->classSymbolName);
bool needsUndefinedClassRef =
!classSym || isa<LazyArchive>(classSym) || isa<LazyObject>(classSym);
- // Create an undefined reference before markLive() only when it may trigger
- // archive extraction. Existing dylib symbols are marked referenced later
- // if the class stub survives dead stripping.
+ // Create an undefined reference before markLive() only when it may
+ // trigger archive extraction. Existing dylib symbols are marked
+ // referenced later if the class stub survives dead stripping.
if (needsUndefinedClassRef)
classSym = symtab->addUndefined(parsed->classSymbolName,
/*file=*/nullptr, /*isWeakRef=*/false);
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 6882b3064..9ecd42835 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -964,8 +964,8 @@ void ObjCStubsSection::addEntry(Symbol *sym) {
std::optional<ObjCClassStubNames> parsed = parseObjCClassStubSymbol(sym);
if (!parsed) {
error("malformed objc class stub symbol " + sym->getName() +
- "; expected " + objcMsgSendClassStubPrefix + "<selector>" +
- "$" + objcClassSymbolPrefix + "<class>");
+ "; expected " + objcMsgSendClassStubPrefix + "<selector>" + "$" +
+ objcClassSymbolPrefix + "<class>");
replaceWithEmptyStub();
return;
}
diff --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h
index a9ff0cddc..42fe3b44e 100644
--- a/lld/MachO/SyntheticSections.h
+++ b/lld/MachO/SyntheticSections.h
@@ -347,8 +347,7 @@ public:
static constexpr llvm::StringLiteral objcMsgSendStubPrefix = "_objc_msgSend$";
static constexpr llvm::StringLiteral objcMsgSendClassStubPrefix =
"_objc_msgSendClass$";
- static constexpr llvm::StringLiteral objcClassSymbolPrefix =
- "_OBJC_CLASS_$_";
+ static constexpr llvm::StringLiteral objcClassSymbolPrefix = "_OBJC_CLASS_$_";
// Plain selector stub: _objc_msgSend$<selector>.
static bool isObjCMsgSendStubSymbol(Symbol *sym);
// Class-message stub: _objc_msgSendClass$<selector>$_OBJC_CLASS_$_<class>.
@@ -360,7 +359,8 @@ public:
StringRef selectorName;
StringRef classSymbolName;
};
- static std::optional<ObjCClassStubNames> parseObjCClassStubSymbol(Symbol *sym);
+ static std::optional<ObjCClassStubNames>
+ parseObjCClassStubSymbol(Symbol *sym);
void recordClassSymbol(Symbol *stubSym, Symbol *classSym);
Symbol *lookupClassSymbol(Symbol *stubSym) const;
``````````
</details>
https://github.com/llvm/llvm-project/pull/219744
More information about the llvm-branch-commits
mailing list