build-many-glibcs.py: Fix “glibcs i686-gnu --strip”

Message ID 875zid3n1g.fsf@oldenburg2.str.redhat.com
State Committed
Headers

Commit Message

Florian Weimer Dec. 18, 2019, 11:12 a.m. UTC
  As posted, this change depends on the build-many-glibc.py for built-in
system call tables, but this addresses a pre-existing issue.

Verified that stripping works on x86_64-linux-gnu, i686-linux-gnu,
x86_64-linux-gnu powerpc64le-linux-gnu (the installed files are actually
unchanged there), and that i686-gnu now has stripped shared objects.

Thanks,
Florian
8<------------------------------------------------------------------8<

Hurd sues an empty prefix, so the linker scripts end up in /lib, the
find command picked them up, and stripping them failed because they
are not ELF files.

-----
 scripts/build-many-glibcs.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

--
(Footer added to prevent Zimbra from stripping trailing whitespace.)
  

Comments

Joseph Myers Dec. 18, 2019, 5:54 p.m. UTC | #1
On Wed, 18 Dec 2019, Florian Weimer wrote:

> As posted, this change depends on the build-many-glibc.py for built-in
> system call tables, but this addresses a pre-existing issue.
> 
> Verified that stripping works on x86_64-linux-gnu, i686-linux-gnu,
> x86_64-linux-gnu powerpc64le-linux-gnu (the installed files are actually
> unchanged there), and that i686-gnu now has stripped shared objects.
> 
> Thanks,
> Florian
> 8<------------------------------------------------------------------8<
> 
> Hurd sues an empty prefix, so the linker scripts end up in /lib, the
> find command picked them up, and stripping them failed because they
> are not ELF files.

This is OK (with s/sues/uses/ in the log message).
  

Patch

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index eedaa55033..4afcd5aaea 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1480,10 +1480,15 @@  class GlibcPolicyForBuild(GlibcPolicyDefault):
 
     def extra_commands(self, cmdlist):
         if self.strip:
-            cmdlist.add_command('strip',
-                                ['sh', '-c',
-                                 ('%s $(find %s/lib* -name "*.so")' %
-                                  (self.strip, self.installdir))])
+            # 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))])
         cmdlist.add_command('check', ['make', 'check'])
         cmdlist.add_command('save-logs', [self.save_logs], always_run=True)