[lld] ELF: Have __rela_iplt_{start,end} surround .rela.iplt with --pack-dyn-relocs=android. (PR #118585)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 19:18:02 PST 2024


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 3dc97557d1ac0cd7924b9679efbfc8f916f5365e 41c06d176db62940e0f9fbced5bb4e87c5494ded --extensions h,cpp -- lld/ELF/Relocations.cpp lld/ELF/Relocations.h lld/ELF/Writer.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 204599c544..2268121827 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1694,7 +1694,8 @@ RelocationBaseSection &elf::getIRelativeSection(Ctx &ctx) {
   // unrelocated globals with RELR relocations when
   // --pack-relative-relocs=android+relr is enabled. Work around this by placing
   // IRELATIVE in .rela.plt.
-  return ctx.arg.androidPackDynRelocs ? *ctx.in.relaPlt : *ctx.mainPart->relaDyn;
+  return ctx.arg.androidPackDynRelocs ? *ctx.in.relaPlt
+                                      : *ctx.mainPart->relaDyn;
 }
 
 static bool handleNonPreemptibleIfunc(Ctx &ctx, Symbol &sym, uint16_t flags) {
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index aa7c36bc9a..49616fa03e 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -847,7 +847,7 @@ template <class ELFT> void Writer<ELFT>::setReservedSymbolSections() {
   // .rela_iplt_{start,end} mark the start and the end of the section containing
   // IRELATIVE relocations.
   if (ctx.sym.relaIpltStart) {
-    auto &dyn =  getIRelativeSection(ctx);
+    auto &dyn = getIRelativeSection(ctx);
     if (dyn.isNeeded()) {
       ctx.sym.relaIpltStart->section = &dyn;
       ctx.sym.relaIpltEnd->section = &dyn;

``````````

</details>


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


More information about the llvm-commits mailing list