[lld] [ELF][LoongArch] -r: Synthesize R_LARCH_ALIGN at input section start (PR #153935)

Lu Weining via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 05:49:54 PDT 2025


================
@@ -1230,9 +1230,9 @@ bool LinkerScript::assignOffsets(OutputSection *sec) {
   if (sec->firstInOverlay)
     state->overlaySize = 0;
 
-  bool synthesizeAlign = ctx.arg.relocatable && ctx.arg.relax &&
-                         (sec->flags & SHF_EXECINSTR) &&
-                         ctx.arg.emachine == EM_RISCV;
+  bool synthesizeAlign =
+      ctx.arg.relocatable && ctx.arg.relax && (sec->flags & SHF_EXECINSTR) &&
+      (ctx.arg.emachine == EM_RISCV || ctx.arg.emachine == EM_LOONGARCH);
----------------
SixWeining wrote:

```suggestion
      (ctx.arg.emachine == EM_LOONGARCH || ctx.arg.emachine == EM_RISCV);
```

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


More information about the llvm-commits mailing list