public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: <libc-alpha@sourceware.org>
Subject: Fix build-many-glibcs.py --strip for installed library renaming
Date: Wed, 15 Sep 2021 01:24:35 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2109150122200.1167011@digraph.polyomino.org.uk> (raw)

The renaming of installed shared libraries to use the SONAME directly
rather than linking to a versioned name stopped build-many-glibcs.py
--strip (used to facilitate comparing binaries before and after
changes that aren't meant to change any generated code in installed
glibc shared libraries) from stripping most of the installed shared
libraries, because it stripped only the *.so names.  Fix it to strip
*.so* names instead and to detect the case of linker scripts using
grep instead of hardcoding particular files that are linker scripts.

Tested with build-many-glibcs.py --strip.

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 54bef43429..258a1be27d 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1553,15 +1553,13 @@ class GlibcPolicyForBuild(GlibcPolicyDefault):
 
     def extra_commands(self, cmdlist):
         if self.strip:
-            # Avoid picking up libc.so and libpthread.so, which are
-            # linker scripts stored in /lib on Hurd.  libc and
-            # libpthread are still stripped via their libc-X.YY.so
-            # implementation files.
-            find_command = (('find %s/lib* -name "*.so"'
-                             + r' \! -name libc.so \! -name libpthread.so')
-                            % self.installdir)
-            cmdlist.add_command('strip', ['sh', '-c', ('%s $(%s)' %
-                                  (self.strip, find_command))])
+            # Avoid stripping libc.so and libpthread.so, which are
+            # linker scripts stored in /lib on Hurd.
+            find_command = 'find %s/lib* -name "*.so*"' % self.installdir
+            cmdlist.add_command('strip', ['sh', '-c', (
+                'set -e; for f in $(%s); do '
+                'if ! head -c16 $f | grep -q "GNU ld script"; then %s $f; fi; '
+                'done' % (find_command, self.strip))])
         cmdlist.add_command('check', ['make', 'check'])
         cmdlist.add_command('save-logs', [self.save_logs], always_run=True)
 

-- 
Joseph S. Myers
joseph@codesourcery.com

             reply	other threads:[~2021-09-15  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15  1:24 Joseph Myers [this message]
2021-09-16 12:08 ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2109150122200.1167011@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).