From Fedora Project Wiki

Change to the default behaviour of ld

Summary

Change DSO-linking semantics of the gcc compiler. Previously calls to the linker (ld) from gcc would result in dangerous default behaviour where ld would attempt to implicitly satisfy link requirements. The proposed change will prevent ld from automatically searching in the dependencies of linked objects.

Owner

  • Name: Charley Wang, Roland Grunberg
  • E-mail: chwang at redhat.com, rgrunber at redhat.com

Current status

  • Targeted release: Fedora 13
  • Last updated: 2010-02-09
  • Percentage of completion: 100%
  • Mass builds: Completed one mass-build of Fedora-13 packages -- a list of packages that were broken at the time of the mass-build can be found at DSOLinkBugs
  • FTBFS builds that failed due to this feature: https://bugzilla.redhat.com/show_bug.cgi?id=564245
  • Currently working on resolving a potential issue with weak symbols

Detailed Description

Change the default behaviour of ld. The current default behaviour causes DT_NEEDED tags to be automatically emitted for all dependencies of linked libraries. Effectively this means that if you link to lib1 and lib1 depends on lib2, then your program will automatically get lib2 regardless of whether lib2 is used in your program itself. There are some problems with this approach. For example, if your program requires symbols from lib2 but relies on the implicit link via lib1, then your program is vulnerable to changes to lib1's dependencies. For more information, please see UnderstandingDSOLinkChange. There has also been some discussion of this and other related issues on the mailing list: http://www.opensubscriber.com/message/devel@lists.fedoraproject.org/13259010.html

Benefit to Fedora

As described in UnderstandingDSOLinkChange, the new default behaviour will help address potential problems further down the line if shared objects ever change their dependencies.

Scope

Changes the default behaviour of ld, which will affect compilation.

Test Plan

  1. Run mass mock builds, notify owners of packages that have problems under the new ld.

Done. See https://bugzilla.redhat.com/show_bug.cgi?id=564245

User Experience

Some packages and users writing programs may need to explicitly link shared objects if they have neglected to do so.

Dependencies

None

Contingency Plan

  • Continue without such capability.

Documentation

Description and example is up in UnderstandingDSOLinkChange

Release Notes

In Fedora 13, the the default behaviour of ld changed. The new linker behaviour will no longer automatically link dependencies of the specified libraries.