From patchwork Thu Oct 29 18:06:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 537956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48296140D5F for ; Fri, 30 Oct 2015 05:06:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=F1/c8VIv; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=WNJmhJ/VlPUqxlw+Ddv0PAjLhLH3+ wXJFEf/52Q15ACcFUzU/Li+mxo6jCGog6kEySI5Lf/OT0u52nicMWiV3bZNddCgn RdmrJ3ju5NTL65WqzikZ+oe4Y6KiVcTGsXT34Z+CuzcQ9lvePdzPP1/VCWD/D9zb CDfEU6jk57vWQk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=NA+TUjwP7eTOpMf47j48ok+ms04=; b=F1/ c8VIv5f//zAOxihU87agHDxV6qiNwSt/4GDZf9Knmc8zQ+hacJqTjxgVqaIqFhBM UpdMSMis+2MKzLc9kKaKqyv/RpfmGO1om+jaP1HJuJsWhW3Ad373lsqfFTLqpzEf v0SYyuvAyrTqTSFcqKw71EwM5Mx5OnlIODB1Y3v4= Received: (qmail 2888 invoked by alias); 29 Oct 2015 18:06:16 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 2745 invoked by uid 89); 29 Oct 2015 18:06:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: [PATCH] Implement "make update-all-abi" X-Enigmail-Draft-Status: N1110 Message-ID: <56326011.4030506@redhat.com> Date: Thu, 29 Oct 2015 19:06:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 This picks up an old idea, from this thread: This patch depends on the abilist format change. The new implementation just uses sort and one invocation of “comm”. I tested ABI updates in string and resolv subdirectories, on x86_64 and ppc64le (which defines abilist-pattern). Florian 2015-10-29 Florian Weimer * scripts/update-abilist.sh: New file. * Makefile (+subdir_targets): Add subdir_update-all-abi. * Makerules (update-all-abi-%, update-all-abi) (subdir_update-all-abi): New targets. * elf/Makefile (update-all-abi): New target. diff --git a/Makefile b/Makefile index 1d800e3..9a01c93 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ endif # $(AUTOCONF) = no subdir_clean subdir_distclean subdir_realclean \ tests xtests \ subdir_update-abi subdir_check-abi \ + subdir_update-all-abi \ subdir_echo-headers \ subdir_install \ subdir_objs subdir_stubs subdir_testclean \ diff --git a/Makerules b/Makerules index 1329f73..1b73144 100644 --- a/Makerules +++ b/Makerules @@ -1347,25 +1347,48 @@ define update-abi fi endef -.PHONY: update-abi check-abi +# Patch all .abilist files for one DSO. Avoid updating the abilist +# files in /generic/, because these are kept empty. +ifdef abilist-pattern +update-all-abi-%: $(abilist-pattern) $(objpfx)%.symlist + $(update-all-abi) +update-all-abi-%: $(abilist-pattern) $(common-objpfx)%.symlist + $(update-all-abi) +endif +update-all-abi-%: %.abilist $(objpfx)%.symlist + $(update-all-abi) +update-all-abi-%: %.abilist $(common-objpfx)%.symlist + $(update-all-abi) +define update-all-abi +bash $(..)scripts/update-abilist.sh $^ \ + $$(find $(..)sysdeps \ + -regextype posix-egrep -regex '.*/$*([^a-z0-9].*)?\.abilist$$' \ + \! -regex '.*/generic/.*') +endef + +.PHONY: update-abi update-all-abi check-abi update-abi: $(patsubst %.so,update-abi-%,$(install-lib.so-versioned)) +update-all-abi: $(patsubst %.so,update-all-abi-%,$(install-lib.so-versioned)) check-abi-list = $(patsubst %.so,$(objpfx)check-abi-%.out, \ $(install-lib.so-versioned)) check-abi: $(check-abi-list) ifdef subdir subdir_check-abi: check-abi subdir_update-abi: update-abi +subdir_update-all-abi: update-all-abi else check-abi: subdir_check-abi if grep -q '^FAIL:' $(objpfx)*/check-abi*.test-result; then \ cat $(objpfx)*/check-abi*.out && exit 1; fi update-abi: subdir_update-abi +update-all-abi: subdir_update-all-abi endif ifeq ($(subdir),elf) check-abi: $(objpfx)check-abi-libc.out tests-special += $(objpfx)check-abi-libc.out update-abi: update-abi-libc +update-all-abi: update-all-abi-libc common-generated += libc.symlist endif diff --git a/elf/Makefile b/elf/Makefile index 546c8eb..8341397 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -299,6 +299,7 @@ endif check-abi: $(objpfx)check-abi-ld.out tests-special += $(objpfx)check-abi-ld.out update-abi: update-abi-ld +update-all-abi: update-all-abi-ld include ../Rules diff --git a/scripts/update-abilist.sh b/scripts/update-abilist.sh new file mode 100644 index 0000000..f0924c7 --- /dev/null +++ b/scripts/update-abilist.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Update abilist files based on differences on one architecture. +# Copyright (C) 2015 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +set -e +set -o pipefail +export LC_ALL=C + +if test $# -lt 3 ; then + echo "usage: $0 OLD-FILE NEW-FILE FILES-TO-BE-PATCHED..." 1>&2 + exit 2 +fi + +old_file="$1" +shift +new_file="$1" +shift + +tmp_new_symbols="$(mktemp)" +tmp_patched="$(mktemp)" + +cleanup () { + rm -f -- "$tmp_new_symbols" "$tmp_patched" +} + +trap cleanup 0 + +# -1 skips symbols only in $old_file (deleted symbols). +# -3 skips symbols in both files (unchanged symbols). +comm -1 -3 <(sort -u -- "$old_file") <(sort -u -- "$new_file") \ + > "$tmp_new_symbols" + +new_symbol_count="$(wc -l < "$tmp_new_symbols")" +if test "$new_symbol_count" -eq 0 ; then + echo "info: no symbols added" 1>&2 + exit 0 +fi + +echo "info: $new_symbol_count symbol(s) added" 1>&2 + +for to_be_patched in "$@" ; do + sort -u -o "$tmp_patched" -- "$to_be_patched" "$tmp_new_symbols" + if ! cmp -s -- "$to_be_patched" "$tmp_patched" ; then + echo "info: updating $to_be_patched" 1>&2 + cp -- "$tmp_patched" "$to_be_patched" + fi +done