Re: [patch #8675] elftoolchain strip support

Pavel Raiskup <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
On Friday 27 of November 2015 02:50:27 Ed Maste wrote:
> On 20 September 2015 at 12:12, Ed Maste <[email protected]> wrote:
> > On 27 May 2015 at 13:59, Ed Maste <[email protected]> wrote:
> >>> Currently libtool does not properly detect elftoolchain's version of strip(1).
> >>> The proposed patch fixes this.
> >>
> >> For reference, this issue has been discussed in FreeBSD at
> >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198611
> >>
> >> It's possible to simplify the test a little bit; $EGREP is already
> >> used in libtool.m4. This is what I had:
> >>
> >> --- a/m4/libtool.m4
> >> +++ b/m4/libtool.m4
> >> @@ -2207,7 +2207,8 @@ m4_defun([_LT_CMD_STRIPLIB],
> >>  striplib=
> >>  old_striplib=
> >>  AC_MSG_CHECKING([whether stripping libraries is possible])
> >> -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
> >> +if test -n "$STRIP" && $STRIP -V 2>&1 |
> >> +  $EGREP "GNU strip|strip.*elftoolchain" >/dev/null; then
> >>    test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
> >>    test -z "$striplib" && striplib="$STRIP --strip-unneeded"
> >>    AC_MSG_RESULT([yes])
> >
> > Following up again to see about including this patch in libtool. Is
> > there anything else I can do to have this considered?
> 
> Ping?

Xin Li and Ed, thanks and sorry for the delay.  Can you please check the
attached patch on FreeBSD?  There is separate code fork for
freebsd/elftoolchain so we could possibly use different options than the
defaults which are used with GNU strip.

Pavel
0001-m4-libtool.m4-FreeBSD-elftoolchain-strip-support.patch (text/x-patch, 2.9 KB)
From fcbfc068ca2e711b6a8231b1e4237325cb923a82 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <[email protected]>
Date: Mon, 30 Nov 2015 08:37:18 +0100
Subject: [PATCH] m4/libtool.m4: FreeBSD elftoolchain strip support

References:
http://savannah.gnu.org/patch/?8675
Message-Id: <[email protected]>

* m4/libtool.m4 (_LT_CMD_STRIPLIB): Remove the redundant tests for
empty $old_striplib and $striplib.  Move the test for empty $STRIP
variable up. Allow elftoolchain strip (with the same arguments we
used to have with GNU strip) on FreeBSD.
---
 NO-THANKS     |  2 ++
 m4/libtool.m4 | 39 ++++++++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/NO-THANKS b/NO-THANKS
index 51ec8eb..13a3c4b 100644
--- a/NO-THANKS
+++ b/NO-THANKS
@@ -37,6 +37,7 @@ Bruno Haible			[email protected]
 Dalibor Topic			[email protected]
 David Edelsohn			[email protected]
 DJ Delorie			[email protected]
+Ed Maste			[email protected]
 Erez Zadok			[email protected]
 Eric Blake			[email protected]
 H.J. Lu				[email protected]
@@ -140,5 +141,6 @@ Ulrich Drepper			[email protected]
 Václav Zeman			[email protected]
 Warren Dodge			[email protected]
 Xavier Pianet			[email protected]
+Xin Li
 Юрий Андреевич Пухальский	[email protected]
 Дилян Палаузов			[email protected]
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 2e8c3cf..1b44f02 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2220,26 +2220,35 @@ m4_defun([_LT_CMD_STRIPLIB],
 striplib=
 old_striplib=
 AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  AC_MSG_RESULT([yes])
+if test -z "$STRIP"; then
+  AC_MSG_RESULT([no])
 else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-  darwin*)
-    if test -n "$STRIP"; then
+  if $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+    old_striplib="$STRIP --strip-debug"
+    striplib="$STRIP --strip-unneeded"
+    AC_MSG_RESULT([yes])
+  else
+    case $host_os in
+    darwin*)
+      # FIXME - insert some real tests, host_os isn't really good enough
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
       AC_MSG_RESULT([yes])
-    else
+      ;;
+    freebsd*)
+      if $STRIP -V 2>&1 | $GREP "elftoolchain" >/dev/null; then
+        old_striplib="$STRIP --strip-debug"
+        striplib="$STRIP --strip-unneeded"
+        AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+      fi
+      ;;
+    *)
       AC_MSG_RESULT([no])
-    fi
-    ;;
-  *)
-    AC_MSG_RESULT([no])
-    ;;
-  esac
+      ;;
+    esac
+  fi
 fi
 _LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
 _LT_DECL([], [striplib], [1])
-- 
2.5.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.