Skip to content

Upstream: Static archives and LTO

Shane Peelar edited this page May 21, 2019 · 1 revision

Static library archives (*.a files) are tricky right now due to a bug in the GNU strip utility found in sys-devel/binutils that mangles archives containing LTO symbols. This is because unlike other binutils programs (such as ar, nm, and ranlib), strip doesn't support the LTO linker plugin necessary for processing these symbols. The result is an archive with all of the same symbols, but with a mangled index. Shane wrote a patch for Portage to automatically restore the index of any static archive that has been subsequently stripped. The patch was accepted upstream, so no user action is required if you are on a recent Portage.

Additional details about this can be found in issue #49.

Previously, we used STRIP_MASK to simply avoid stripping any static archives, however this functionality has been removed in EAPI version 7, so a more intrusive solution is necessary. If you are one of these users, you can migrate to the new configuration by:

  • Removing STRIP_MASK="*.a" from make.conf
  • Ensuring you have >=sys-apps/portage-2.3.52 installed

If you are using sys-apps/portage-mgorny, ensure you have the equivalent version installed. The patch was accepted upstream there before it landed in mainstream Portage.