Discussion:
[gentoo-portage-dev] [PATCH] estrip: Run RANLIB after stripping static archives to fix LTO
Michał Górny
2018-10-29 16:46:36 UTC
Permalink
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.

Reported-by: Shane Peelar
Bug: https://github.com/mgorny/portage-mgorny/issues/21
Signed-off-by: Michał Górny <***@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"* ||
--
2.19.1
Zac Medico
2018-10-30 16:44:22 UTC
Permalink
Post by Michał Górny
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.
Reported-by: Shane Peelar
Bug: https://github.com/mgorny/portage-mgorny/issues/21
---
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"* ||
Looks good, please merge and include a reference to
https://bugs.gentoo.org/603594.
--
Thanks,
Zac
Michał Górny
2018-10-31 16:38:05 UTC
Permalink
Post by Zac Medico
Post by Michał Górny
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.
Reported-by: Shane Peelar
Bug: https://github.com/mgorny/portage-mgorny/issues/21
---
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"* ||
Looks good, please merge and include a reference to
https://bugs.gentoo.org/603594.
Merged, thanks.
--
Best regards,
Michał Górny
Loading...