]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Implement "make update-all-abi"
authorFlorian Weimer <fweimer@redhat.com>
Tue, 24 Nov 2015 16:10:19 +0000 (17:10 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 24 Nov 2015 16:10:19 +0000 (17:10 +0100)
* 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.

ChangeLog
Makefile
Makerules
elf/Makefile
scripts/update-abilist.sh [new file with mode: 0644]

index f8c18b141bfb2e67a640bec9fe0c85be0b7d45ad..30739e1d54533c3c6f18938ba01bcfa756605a31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-11-24  Florian Weimer  <fweimer@redhat.com>
+
+       * 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.
+
 2015-11-24  Florian Weimer  <fweimer@redhat.com>
 
        Replace MUTEX_INITIALIZER with _LIBC_LOCK_INITIALIZER in generic code.
index 1d800e30bbfb87ebbcf366cb0e93a6297f9e8897..9a01c93e5de99fb5be96326bb927cb80d2a698b4 100644 (file)
--- 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            \
index 1329f73c3843dda842dcfa589c2747746adbb804..fa240307f0f79493cf66908b46e0a8110610185a 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -1347,25 +1347,54 @@ define update-abi
  fi
 endef
 
-.PHONY: update-abi check-abi
+# Patch all .abilist files for one DSO.  The find command locates
+# abilist files for all architectures.  The regular expression in the
+# find invocation is needed to separate libc.abilist and
+# libcrypt.abilist, for example.  It assumes that abilist-pattern, if
+# set, is of the form "%-SUFFIX", and not "%SUFFIX", that is, there is
+# a non-alphanumeric seperator between the pattern and the suffix
+# added.  The abilist files in /generic/ are filtered out because
+# these are expected to remain empty.
+define update-all-abi
+$(SHELL) $(..)scripts/update-abilist.sh $^ \
+  $$(find $(..)sysdeps \
+    -regextype posix-egrep -regex '.*/$*([^a-z0-9].*)?\.abilist$$' \
+    \! -regex '.*/generic/.*')
+endef
+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)
+
+.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
 
index 9d2dc5c1bafd48a1779fbfb36450cbbf69d0c2ce..f03b2912d28bccdfc4b82ec2a8ccb89bd7a2e24a 100644 (file)
@@ -301,6 +301,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
 
 ifeq ($(have-glob-dat-reloc),yes)
 tests += tst-prelink
diff --git a/scripts/update-abilist.sh b/scripts/update-abilist.sh
new file mode 100644 (file)
index 0000000..0c2d0ff
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+# 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
+# <http://www.gnu.org/licenses/>.
+
+set -e
+export LC_ALL=C
+
+if [ $# -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_old_sorted="$(mktemp)"
+tmp_new_sorted="$(mktemp)"
+tmp_new_symbols="$(mktemp)"
+tmp_patched="$(mktemp)"
+
+cleanup () {
+  rm -f -- "$tmp_old_sorted" "$tmp_new_sorted" \
+    "$tmp_new_symbols" "$tmp_patched"
+}
+
+trap cleanup 0
+
+sort -u -o "$tmp_old_sorted" -- "$old_file"
+sort -u -o "$tmp_new_sorted" -- "$new_file"
+
+# -1 skips symbols only in $old_file (deleted symbols).
+# -3 skips symbols in both files (unchanged symbols).
+comm -1 -3 "$tmp_old_sorted" "$tmp_new_sorted" > "$tmp_new_symbols"
+
+new_symbol_count="$(wc -l < "$tmp_new_symbols")"
+if [ "$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