Features/GoldLinkerDefault

From FedoraProject

Jump to: navigation, search

Contents

Features/GoldLinkerDefault

Summary

Gold is a replacement for the aging gnu linker (gld) created by Ian Taylor and was integrated into binutils-2.18.

Owner

  • Email: <law@redhat.com>

Current status

  • Targeted release: Fedora ??
  • Last updated: July 7, 2010
  • Percentage of completion: 70%

Detailed Description

Gold was included as an alternative for gnu-ld in Fedora 13. For Fedora 14, I think we should seriously consider making Gold the default linker for everything except glibc and the kernel. We would continue to use gnu-ld for glibc, the kernel and gnu-ld would be available as an alternative for gold.

Benefit to Fedora

Gold is more efficient than gnu-ld, particularly for large C++ applications. There have been reports of 5x improvements for applications with link sizes on the order of 800M. Gold is also useful for GCC's link-time-optimizations and will likely be a required for incremental linking in the future.

Scope

First, glibc & the kernel need to explicitly run "ld.bfd" rather than "ld" so ensure they continue to use the old gnu-ld rather than gold.

Second, the default linker should be switched from ld.bfd (gnu-ld) to gold.

Third, rebuild everything. In theory, any compatibility issues between gold and gnu-ld were addressed during the Fedora 13 cycle. But a mass rebuild should be run as soon as possible to weed out any new problems.

How To Test

We need testing for each of the platforms supported by Fedora (x86, x86_64, etc).

First gold has a testsuite which should successfully run during building of the binutils RPMs.

To test an existing (Fedora 13 or rawhide) system, first switch to gold as the system linker. "/usr/sbin/alternatives --set ld /usr/bin/ld.gold". Then continue development as normal. If all is working correctly, you should see no change in behaviour, particularly during linking of applications or execution of applications.

A more thorough test would be a mass rebuild of all the Fedora packages before/after switching the default to gold. Any packages that build with gnu-ld (ld.bfd) but fail to build with gold would need to be investigated. I believe this test was performed for Fedora 13 and packages were fixed accordingly. However, re-testing everything for Fedora 14 as soon as possible would be wise.

User Experience

The only user-visible change should be link times improve, particularly for very large applications.

Dependencies

All architecture specific RPMs ultimately depend on the linker, just like they depend on the compiler & assembler.

The major dependencies are getting the glibc & kernel packages to call the old linker explicitly (ld.bfd) as those packages use linker-script features not available in gold. In theory the rest of the Fedora packages are already "gold ready".

Contingency Plan

None necessary, we can simply continue to use the gnu-ld linker instead of gold.

Documentation

Included in the binutils package.

Release Notes

Using gold instead of gnu-ld as the default linker can cause some applications to fail to link if those applications depend on the incorrect behaviour of gnu-ld with respect to symbol resolution in indirect shared libraries. See https://fedoraproject.org/wiki/GoldIncompatibilities.

Comments and Discussion