[lld] [lld][LoongArch] Default disable linker relaxation in LoongArch. (PR #123017)

Zhaoxin Yang via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 22:10:11 PST 2025


https://github.com/ylzsx updated https://github.com/llvm/llvm-project/pull/123017

>From b05cb42e78aef9cab84a32570e59dee03831f245 Mon Sep 17 00:00:00 2001
From: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: Wed, 15 Jan 2025 11:41:43 +0800
Subject: [PATCH] [lld][LoongArch] Default disable linker relaxation in
 LoongArch.

---
 lld/ELF/Driver.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 13e8f8ce6df207..9515b4f8e60ac9 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1893,6 +1893,10 @@ static void setConfigs(Ctx &ctx, opt::InputArgList &args) {
       ErrAlways(ctx) << "cannot open --why-extract= file " << ctx.arg.whyExtract
                      << ": " << e.message();
   }
+
+  // Default disable LoongArch linker relaxation.
+  if (ctx.arg.emachine == EM_LOONGARCH)
+    ctx.arg.relax = args.hasFlag(OPT_relax, OPT_no_relax, false);
 }
 
 static bool isFormatBinary(Ctx &ctx, StringRef s) {



More information about the llvm-commits mailing list