Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ylzsx
Copy link
Contributor

@ylzsx ylzsx commented Jan 15, 2025

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.

@llvmbot
Copy link
Member

llvmbot commented Jan 15, 2025

@llvm/pr-subscribers-backend-loongarch
@llvm/pr-subscribers-lld-elf

@llvm/pr-subscribers-lld

Author: Zhaoxin Yang (ylzsx)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/123017.diff

1 Files Affected:

  • (modified) lld/ELF/Driver.cpp (+4)
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) {

@ylzsx ylzsx force-pushed the disable-lld-relax branch from 11e4481 to b05cb42 Compare January 15, 2025 06:10
@ylzsx ylzsx requested a review from MaskRay January 15, 2025 06:10
Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed before relaxation is implemented for LoongArch.

@ylzsx
Copy link
Contributor Author

ylzsx commented Jan 15, 2025

This is not needed before relaxation is implemented for LoongArch.

We have completed the corresponding code and performed preliminary testing (Linux, llvm-test-suite, etc.), with approximately 8 patches. One of them is #122209.

ylzsx added a commit to ylzsx/llvm-project that referenced this pull request Jan 15, 2025
@ylzsx
Copy link
Contributor Author

ylzsx commented Jan 17, 2025

We have completed the corresponding code and performed preliminary testing (Linux, llvm-test-suite, etc.), with approximately 8 patches. One of them is #122209.

I plan to push the 8 patches as PRs for review by colleagues within the next couple of days. Do you think the current patches(default disable linker relaxation) should be added after these patches are merged? Any suggestions will be fairly appreciated.

ylzsx added a commit to ylzsx/llvm-project that referenced this pull request Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants