From patchwork Wed Sep 15 01:24:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 45003 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9C5B385782A for ; Wed, 15 Sep 2021 01:24:55 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 438DE3858402 for ; Wed, 15 Sep 2021 01:24:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 438DE3858402 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: 7HSNj9+HW3KMtgcVFnnrXdSMQ6wM56aC1Hm+h18JBpzgx4qszC7NSwYXBe8/12Vz5evY/udy9c UddMNeYT007Qhyi6LEVHk22A7JYCdE9UUcCEiZP8ff9hcyFYHF3KiRJWY9cV8HSiaZPk2NM7Jm phHCD4irDXsrk6FhlTCanBVyJ70co+2cH6O7vXYjsrsuUQwaheWzaj1bs6iGatKcOjCiUw3roB VAPt63UIL6pTBg27KbGpRNGlhoYVT1lDm9G8pRJB8DHQzuc6Fi4B6BeDIWS/Dt7wUjlEcBt2C3 kkHXVbY2Oq0M1QLeD9lnRapZ X-IronPort-AV: E=Sophos;i="5.85,292,1624348800"; d="scan'208";a="65862678" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 14 Sep 2021 17:24:42 -0800 IronPort-SDR: ia7lgF/YByTw7F213ifpjB4ADsF2+/XRBI22v56g34OGf/tXLAaYuvtG0RuqB22WQS9QgDp9bt 0Eix0tE6oN1ZUvpGhko4EQL5gOcmRxfkfb4apTYL2UuWhGgH0TpW1VlxglQ8Iu2SBYwTac98Tr vfcWQemjwYEEECiCcLID+KN44C3JM2n8WgKZMSxHrZXz8AhiJbg30kCfe4LrFJfbDQhcdjsKfW ckVUHkedsOZJYT5Nyngl8JT2Is2Q6b9ycLeQiyW7/YHzptQivuSKcPkASQqwCSXM88L3vKdJup Ye4= Date: Wed, 15 Sep 2021 01:24:35 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Fix build-many-glibcs.py --strip for installed library renaming Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3123.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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)