Skip to content
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

Drop support for deprecated GNU Gold linker on non-Darwin Unix #79163

Open
ADKaster opened this issue Feb 5, 2025 · 1 comment
Open

Drop support for deprecated GNU Gold linker on non-Darwin Unix #79163

ADKaster opened this issue Feb 5, 2025 · 1 comment
Labels
feature A feature request or implementation Linux Platform: Linux

Comments

@ADKaster
Copy link
Contributor

ADKaster commented Feb 5, 2025

Motivation

As of binutils release 2.44 (Feb 2025), the gold linker is officially deprecated, and its sources are no longer included in the default release tarball.

https://lists.gnu.org/archive/html/info-gnu/2025-02/msg00001.html

In a change to our previous practice, in this release the binutils-2.44.tar tarball does not contain the sources for the gold linker. This is because the gold linker is now deprecated and will eventually be removed unless volunteers step forward and offer to continue development and maintenance.

Proposed solution

It's my understanding that bootstrapping Swift on platforms like Linux defaults to using the GNU Gold linker, rather than lld.

Bootstrap scripts and other install instructions should be updated to mention that the gold linker is no longer maintained upstream, and that the lld linker should be used instead.

Looking around it seems like the swift-driver no longer defaults to gold, and respects the -fuse-ld option more readily on main than in previous releases.

Support for the gold linker should be dropped entirely imo. Attempting to use it could result in an error at the driver level, or it could simply be "not recommended" with issues stemming from its use auto-closed with a "not our problem" message.

Alternatives considered

It's unlikely that the swift team or community have the will to maintain the gold linker themselves.

Additional information

No response

@ADKaster ADKaster added feature A feature request or implementation triage needed This issue needs more specific labels labels Feb 5, 2025
@finagolfin finagolfin added Linux Platform: Linux and removed triage needed This issue needs more specific labels labels Feb 6, 2025
@finagolfin
Copy link
Member

Thanks for filing and linking that announcement. The good news is that since the latest 6.0.3 release, the swift-driver always delegates to the C compiler used for linking too, swiftlang/swift-driver@15402470a, and has no more logic to choose a linker itself. Since the clang shipped by Swift picks gold on some platforms, it will still end up using gold there, but that is an upstream LLVM choice.

As for bootstrapping the compiler, unfortunately that is still done with Swift 5.8.1 on the linux CI, and the swift-driver back then chose gold as the linker on some platforms, overriding whatever clang chose. We could of course override that older default in the build presets, which should work fine, because lld has worked well for awhile.

Maybe @etcwilde and @al45tair have more to add, as they made some of those linker changes before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation Linux Platform: Linux
Projects
None yet
Development

No branches or pull requests

2 participants