[lld] [ELF] Add target-specific relocation scanning for RISC-V (PR #181332)

via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 21 19:08:15 PST 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 cpp -- lld/ELF/Arch/RISCV.cpp lld/ELF/Relocations.cpp --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/Relocations.cpp b/lld/ELF/Relocations.cpp
index 648de145f..a3024ed6c 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -1156,9 +1156,8 @@ unsigned RelocScan::handleTlsRelocation(RelExpr expr, RelType type,
        type == R_LARCH_TLS_DESC_PCREL20_S2);
 
   // LoongArch does not support GD/LD to IE/LE optimizations.
-  bool execOptimize =
-      !ctx.arg.shared &&
-      (ctx.arg.emachine != EM_LOONGARCH || execOptimizeInLoongArch);
+  bool execOptimize = !ctx.arg.shared && (ctx.arg.emachine != EM_LOONGARCH ||
+                                          execOptimizeInLoongArch);
 
   // If we are producing an executable and the symbol is non-preemptable, it
   // must be defined and the code sequence can be optimized to use Local-Exec.

``````````

</details>


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


More information about the llvm-commits mailing list