commit:     2404ddca9d5db7992bf6853cbde8ca944224560c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 29 16:41:45 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Oct 31 16:37:35 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2404ddca

estrip: Run RANLIB after stripping static archives to fix LTO

Run RANLIB after stripping static archives in order to fix potentially
mangled LTO symbol indexes.  According to the user's report, strip lacks
support for LTO symbols (and for binutils plugins that could add
the missing support) and breaks them.  Upstream suggests fixing
the archive by running ranlib -- and since there should be no harm
in doing that, we can do that unconditionally.

Suggested-by: Shane Peelar
Bug: https://github.com/mgorny/portage-mgorny/issues/21
Bug: https://bugs.gentoo.org/603594
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/estrip | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/estrip b/bin/estrip
index 369755cfe..f72341da9 100755
--- a/bin/estrip
+++ b/bin/estrip
@@ -113,7 +113,7 @@ if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then
 fi
 
 # look up the tools we might be using
-for t in STRIP:strip OBJCOPY:objcopy READELF:readelf ; do
+for t in STRIP:strip OBJCOPY:objcopy READELF:readelf RANLIB:ranlib ; do
        v=${t%:*} # STRIP
        t=${t#*:} # strip
        eval ${v}=\"${!v:-${CHOST}-${t}}\"
@@ -423,7 +423,8 @@ do
                        # linked in (only for finally linked ELFs), so we have 
to
                        # retain the debug info in the archive itself.
                        if ! ${FEATURES_splitdebug} || ${RESTRICT_splitdebug} ; 
then
-                               ${STRIP} -g "${x}"
+                               ${STRIP} -g "${x}" &&
+                               ${RANLIB} "${x}"
                        fi
                fi
        elif [[ ${f} == *"SB executable"* || ${f} == *"SB pie executable"* ||

Reply via email to