mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 17:43:35 +03:00
Linux: Don't default to ld.gold linker
I hope the issues with old bfd aren't really a thing anymore. The main reason is that the user might have set LLD as default `/usr/bin/ld` symlink, and LDC not using it by default isn't intuitive. And LLD can be significantly faster than gold.
This commit is contained in:
parent
4fcbd692bb
commit
e125411e98
1 changed files with 5 additions and 15 deletions
|
@ -587,22 +587,12 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
|
|||
void ArgsBuilder::addLinker() {
|
||||
llvm::StringRef linker = opts::linker;
|
||||
|
||||
// We have a default linker preference for Linux targets. It can be disabled
|
||||
// via `-linker=` (explicitly empty).
|
||||
if (global.params.targetTriple->isOSLinux() &&
|
||||
// Default to ld.bfd for Android (placing .tdata and .tbss sections adjacent
|
||||
// to each other as required by druntime's rt.sections_android, contrary to
|
||||
// gold and lld as of Android NDK r21d).
|
||||
if (global.params.targetTriple->getEnvironment() == llvm::Triple::Android &&
|
||||
opts::linker.getNumOccurrences() == 0) {
|
||||
// Default to ld.bfd for Android (placing .tdata and .tbss sections adjacent
|
||||
// to each other as required by druntime's rt.sections_android, contrary to
|
||||
// gold and lld as of Android NDK r21d).
|
||||
if (global.params.targetTriple->getEnvironment() == llvm::Triple::Android) {
|
||||
linker = "bfd";
|
||||
}
|
||||
// Otherwise default to ld.gold for Linux due to ld.bfd issues with ThinLTO
|
||||
// (see #2278) and older bfd versions stripping llvm.used symbols (e.g.,
|
||||
// ModuleInfo refs) with --gc-sections (see #2870).
|
||||
else {
|
||||
linker = "gold";
|
||||
}
|
||||
linker = "bfd";
|
||||
}
|
||||
|
||||
if (!linker.empty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue