[lld] [WIP/RFC][ELF][PowerPC] Don't assume TOC pointer is valid in IPLT entries (PR #207555)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 4 20:16:44 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/ELF/Arch/PPC.cpp lld/ELF/Arch/PPC64.cpp lld/ELF/Thunks.cpp lld/ELF/Thunks.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/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp
index a16176b7e..901757ccb 100644
--- a/lld/ELF/Arch/PPC.cpp
+++ b/lld/ELF/Arch/PPC.cpp
@@ -201,8 +201,8 @@ void PPC::initTargetSpecificSections() {
 void PPC::writeIplt(uint8_t *buf, const Symbol &sym,
                     uint64_t pltEntryAddr) const {
   // In -pie or -shared mode we can't rely on r30 for indirect calls.
-  writePPC32PltCallStub(ctx, buf, pltEntryAddr, sym.getGotPltVA(ctx),
-                        sym.file, std::nullopt);
+  writePPC32PltCallStub(ctx, buf, pltEntryAddr, sym.getGotPltVA(ctx), sym.file,
+                        std::nullopt);
 }
 
 void PPC::writeGotHeader(uint8_t *buf) const {
diff --git a/lld/ELF/Thunks.h b/lld/ELF/Thunks.h
index 5fa6b959f..ee5befeee 100644
--- a/lld/ELF/Thunks.h
+++ b/lld/ELF/Thunks.h
@@ -84,7 +84,8 @@ std::unique_ptr<Thunk> addThunk(Ctx &, const InputSection &isec,
 std::unique_ptr<Thunk> addLandingPadThunk(Ctx &, Symbol &s, int64_t a);
 
 void writePPC32PltCallStub(Ctx &, uint8_t *buf, uint64_t p, uint64_t gotPltVA,
-                           const InputFile *file, std::optional<int64_t> addend);
+                           const InputFile *file,
+                           std::optional<int64_t> addend);
 void writePPC64LoadAndBranch(Ctx &, uint8_t *buf, uint64_t p, uint64_t addr,
                              bool toc = true);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/207555


More information about the llvm-commits mailing list