[lld] [RISCV] Disable gp relaxation if part of object unreachable (PR #72655)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 07:30:33 PST 2023


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 f5016597687c404ea5205f1e40d80ce139d20d72 0a64d43e3cc472a78021b278e8bf9c3cdba57ae4 -- lld/ELF/Arch/RISCV.cpp
``````````

</details>

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

``````````diff
diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp
index 7d01e7f89c..ecbf8aaeeb 100644
--- a/lld/ELF/Arch/RISCV.cpp
+++ b/lld/ELF/Arch/RISCV.cpp
@@ -674,9 +674,8 @@ static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc,
 
     // However, if the addend is non-zero, the LO12 relocations may be accessing
     // the range [HI-alignAdjust-1, HI+alignAdjust].
-    if (r.addend != 0 &&
-        (!isInt<12>(hiAddr - alignAdjust - 1 - gp->getVA()) ||
-         !isInt<12>(hiAddr + alignAdjust - gp->getVA())))
+    if (r.addend != 0 && (!isInt<12>(hiAddr - alignAdjust - 1 - gp->getVA()) ||
+                          !isInt<12>(hiAddr + alignAdjust - gp->getVA())))
       return;
 
     // Remove lui rd, %hi20(x).

``````````

</details>


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


More information about the llvm-commits mailing list