public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Fix build-many-glibcs.py --strip for installed library renaming
@ 2021-09-16 14:08 Joseph Myers
  0 siblings, 0 replies; only message in thread
From: Joseph Myers @ 2021-09-16 14:08 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=876e51548cc5d96af5ea13febd0a1a75bfc04497

commit 876e51548cc5d96af5ea13febd0a1a75bfc04497
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Sep 16 14:08:05 2021 +0000

    Fix build-many-glibcs.py --strip for installed library renaming
    
    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:
---
 scripts/build-many-glibcs.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

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)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-16 14:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 14:08 [glibc] Fix build-many-glibcs.py --strip for installed library renaming Joseph Myers

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).