From patchwork Tue Jun 29 10:13:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 44048 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 781E9397EC17 for ; Tue, 29 Jun 2021 10:17:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 781E9397EC17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1624961861; bh=3vA+MsXoz4FkO1vpRWJXLtzBo3hwF8O7TCZIGN1Yzn8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Z2Qp6JRla0a0+mQXL504ZZJVB5gtxfIMJN2Bun3ic3fU3hBftmZ8gGcTSEpOVmylQ AJLUVxi7gz/6sj/5Z8bMGT89LMKyPsOYKifL/pU/p3ICmO0guiFkWddG0MENSIOra6 TUbztcZhA00jxX4RRXp4me8LXIYgIjOGJO7bKf00= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 84FB3397EC17 for ; Tue, 29 Jun 2021 10:14:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 84FB3397EC17 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-237-T3jLKscQN1-nLP3RM813NQ-1; Tue, 29 Jun 2021 06:14:02 -0400 X-MC-Unique: T3jLKscQN1-nLP3RM813NQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4D8EF100C610; Tue, 29 Jun 2021 10:14:01 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-112-228.ams2.redhat.com [10.36.112.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F09B5D9DC; Tue, 29 Jun 2021 10:14:00 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH] nptl_db: Re-use the ELF-to-abilist converter for ABI checking Date: Tue, 29 Jun 2021 12:13:58 +0200 Message-ID: <87eeclm109.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Cc: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The previous approach uses readelf -DWs, which does not produce a stable output format (older binutils versions do not include symbol version information). This commit re-uses scripts/abilist.awk with a tweak to include GLIBC_PRIVATE symbols. This awk script is based on objdump -T output, which appears to be stable over time. For me, this fixes nptl/db-symbols with binutils 2.30. Also tested in the usual way (build-many-glibcs.py is still running, but is looking good so far). Reviewed-by: Szabolcs Nagy --- nptl_db/Makefile | 9 +++++++-- nptl_db/db-symbols.awk | 15 +++++---------- scripts/abilist.awk | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/nptl_db/Makefile b/nptl_db/Makefile index c04aa6140a..8ad4f90e84 100644 --- a/nptl_db/Makefile +++ b/nptl_db/Makefile @@ -54,8 +54,13 @@ tests-special += $(objpfx)db-symbols.out include ../Rules $(objpfx)db-symbols.out: $(objpfx)db-symbols.v.i \ - $(common-objpfx)libc.so - LC_ALL=C $(READELF) -W -D -s $(filter %.so,$^) | $(AWK) -f $< > $@; \ + $(objpfx)libc.symlist-private + LC_ALL=C $(AWK) -f $^ > $@; \ $(evaluate-test) $(objpfx)db-symbols.v.i: db-symbols.awk + +$(objpfx)libc.symlist-private: $(..)scripts/abilist.awk \ + $(common-objpfx)libc.dynsym + LC_ALL=C $(AWK) -v include_private=1 -f $^ > $@T + mv -f $@T $@ diff --git a/nptl_db/db-symbols.awk b/nptl_db/db-symbols.awk index fe90d3b435..67034c3e89 100644 --- a/nptl_db/db-symbols.awk +++ b/nptl_db/db-symbols.awk @@ -1,5 +1,5 @@ -# This script processes the output of 'readelf -W -D -s' on the libc.so -# we've just built. It checks for all the symbols used in td_symbol_list. +# This script processes the libc.so abilist (with GLIBC_PRIVATE +# symbols included). It checks for all the symbols used in td_symbol_list. BEGIN { %define DB_MAIN_VARIABLE(name) /* Nothing. */ @@ -12,18 +12,14 @@ BEGIN { in_symtab = 0; } -/Symbol table for image/ { in_symtab=1; next } -NF == 0 { in_symtab=0; next } - -!in_symtab { next } - -NF >= 8 && $7 != "UND" { seen[$NF] = 1 } +/^GLIBC_PRIVATE / { + seen[$2] = 1 +} END { status = 0; for (s in required) { - s = s "@@GLIBC_PRIVATE" if (s in seen) print s, "ok"; else { status = 1; @@ -33,7 +29,6 @@ END { any = ""; for (s in th_unique) { - s = s "@@GLIBC_PRIVATE" if (s in seen) { any = s; break; diff --git a/scripts/abilist.awk b/scripts/abilist.awk index a43400d5b4..24a34ccbed 100644 --- a/scripts/abilist.awk +++ b/scripts/abilist.awk @@ -55,7 +55,7 @@ $2 == "g" || $2 == "w" && (NF == 7 || NF == 8) { # caused STV_HIDDEN symbols to appear in .dynsym, though that is useless. if (NF > 7 && $7 == ".hidden") next; - if (version == "GLIBC_PRIVATE") next; + if (version == "GLIBC_PRIVATE" && !include_private) next; desc = ""; if (type == "D" && ($4 == ".tbss" || $4 == ".tdata")) {