Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] estrip: Run RANLIB after stripping static archives to fix LTO
Date: Mon, 29 Oct 2018 16:46:58
Message-Id: 20181029164637.9314-1-mgorny@gentoo.org
1 Run RANLIB after stripping static archives in order to fix potentially
2 mangled LTO symbol indexes. According to the user's report, strip lacks
3 support for LTO symbols (and for binutils plugins that could add
4 the missing support) and breaks them. Upstream suggests fixing
5 the archive by running ranlib -- and since there should be no harm
6 in doing that, we can do that unconditionally.
7
8 Reported-by: Shane Peelar
9 Bug: https://github.com/mgorny/portage-mgorny/issues/21
10 Signed-off-by: Michał Górny <mgorny@g.o>
11 ---
12 bin/estrip | 5 +++--
13 1 file changed, 3 insertions(+), 2 deletions(-)
14
15 diff --git a/bin/estrip b/bin/estrip
16 index 369755cfe..f72341da9 100755
17 --- a/bin/estrip
18 +++ b/bin/estrip
19 @@ -113,7 +113,7 @@ if [[ ${KERNEL} == linux ]] && ${FEATURES_xattr} ; then
20 fi
21
22 # look up the tools we might be using
23 -for t in STRIP:strip OBJCOPY:objcopy READELF:readelf ; do
24 +for t in STRIP:strip OBJCOPY:objcopy READELF:readelf RANLIB:ranlib ; do
25 v=${t%:*} # STRIP
26 t=${t#*:} # strip
27 eval ${v}=\"${!v:-${CHOST}-${t}}\"
28 @@ -423,7 +423,8 @@ do
29 # linked in (only for finally linked ELFs), so we have to
30 # retain the debug info in the archive itself.
31 if ! ${FEATURES_splitdebug} || ${RESTRICT_splitdebug} ; then
32 - ${STRIP} -g "${x}"
33 + ${STRIP} -g "${x}" &&
34 + ${RANLIB} "${x}"
35 fi
36 fi
37 elif [[ ${f} == *"SB executable"* || ${f} == *"SB pie executable"* ||
38 --
39 2.19.1

Replies