Remove Excessive Linking
--as-needed flag the linker through default system-wide LDFLAGS.
- Name: Igor Gnatenko, Neal Gompa
- Email: firstname.lastname@example.org, email@example.com
- Release notes owner:
- Targeted release: Fedora 29
- Last updated: 2018-07-03
- Tracker bug: <will be assigned by the Wrangler>
The flag (
--as-needed) tells the linker to link in the produced binary only the libraries containing symbols actually used by the binary itself. This binary can be either a final executale or another library.
The use of the
--as-needed flag allows the linker to avoid linking extra libraries in a binary. This not only improves startup times (as the loader does not have to load all the libraries for every step) but might avoid the full initialization of big frameworks.
Benefit to Fedora
No real tests on Fedora has been made, so no real numbers in this section. But theoretically,
- Better startup times (since loader doesn't have to load all the libraries)
- Smaller metadata (since less dependencies are recorded in final binaries)
- Proposal owners: Add
-Wl,--as-neededinto RPM_LD_FLAGS (in redhat-rpm-config).
- Other developers: Nothing should break, but immediate work-around would be to disable this flag (will be provided in redhat-rpm-config) and fix real issue later.
- Release engineering: #7604 (mass rebuild is desired after this change).
- List of deliverables: N/A (not a System Wide Change)
- Policies and guidelines: Add information how to turn it off (TODO link to FPC ticket).
- Trademark approval: N/A (not needed for this Change)
None for end-users. Developers which build their own packages might notice and should be guided how to fix / workaround issue.
How To Test
Install newest redhat-rpm-config package and build your package.
See Benefit to Fedora section.
- Contingency mechanism: Owners will revert change in redhat-rpm-config and make it opt-in rather than opt-out.
- Contingency deadline: Beta freeze.
- Blocks release? No
- Blocks product? Everything
Only Packaging Guidelines needs to be updated.