[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 21:56:42 PST 2025


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

In the upcoming patches, we will add support for relaxation in LoongArch. However, it will remain disabled by default. After sufficient testing, we will enable it by default.

>From 11e448169059e0eac869f17b5f1b8c2a0d899f05 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..71aa291c05de11 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