5de29b
# commit 1695c7737655241e1773bdddc93e82c22d8d1584
5de29b
# Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
5de29b
# Date:   Tue Feb 4 09:48:47 2014 -0200
5de29b
#
5de29b
#     abilist-pattern configurability
5de29b
#    
5de29b
#     This patch creates implicit rules to match the abifiles if
5de29b
#     abilist-pattern is defined in the architecture Makefile. This allows
5de29b
#     machine specific Makefiles to define different abifiles names
5de29b
#     (for instance *-le.abilist for powerpc64le).
5de29b
#
12745e
diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
12745e
--- glibc-2.17-c758a686/Makerules	2014-06-02 15:29:42.000000000 +0000
12745e
+++ glibc-2.17-c758a686/Makerules	2014-06-02 15:25:21.000000000 +0000
5de29b
@@ -1152,6 +1152,14 @@
5de29b
 	LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
5de29b
 	mv -f $@T $@
5de29b
 
5de29b
+# A sysdeps/.../Makefile can set abilist-pattern to something like
5de29b
+# %-foo.abilist to look for libc-foo.abilist instead of libc.abilist.
5de29b
+# This makes sense if multiple ABIs can be most cleanly supported by a
5de29b
+# configuration without using separate sysdeps directories for each.
5de29b
+ifdef abilist-pattern
5de29b
+vpath $(abilist-pattern) $(+sysdep_dirs)
5de29b
+endif
5de29b
+
5de29b
 vpath %.abilist $(+sysdep_dirs)
5de29b
 
5de29b
 # The .PRECIOUS rule prevents the files built by an implicit rule whose
5de29b
@@ -1161,18 +1169,42 @@
5de29b
 .PRECIOUS: %.symlist
5de29b
 generated += $(extra-libs:=.symlist)
5de29b
 
5de29b
+ifdef abilist-pattern
5de29b
+check-abi-%: $(common-objpfx)config.make $(abilist-pattern) $(objpfx)%.symlist
5de29b
+	$(check-abi-pattern)
5de29b
+check-abi-%: $(common-objpfx)config.make $(abilist-pattern) \
5de29b
+	     $(common-objpfx)%.symlist
5de29b
+	$(check-abi-pattern)
5de29b
+endif
5de29b
 check-abi-%: $(common-objpfx)config.make %.abilist $(objpfx)%.symlist
5de29b
 	$(check-abi)
5de29b
 check-abi-%: $(common-objpfx)config.make %.abilist $(common-objpfx)%.symlist
5de29b
 	$(check-abi)
5de29b
+define check-abi-pattern
5de29b
+	diff -p -U 0 $(filter $(abilist-pattern),$^) $(filter %.symlist,$^)
5de29b
+endef
5de29b
 define check-abi
5de29b
 	diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^)
5de29b
 endef
5de29b
 
5de29b
+ifdef abilist-pattern
5de29b
+update-abi-%: $(objpfx)%.symlist $(abilist-pattern)
5de29b
+	$(update-abi-pattern)
5de29b
+update-abi-%: $(common-objpfx)%.symlist $(abilist-pattern)
5de29b
+	$(update-abi-pattern)
5de29b
+endif
5de29b
 update-abi-%: $(objpfx)%.symlist %.abilist
5de29b
 	$(update-abi)
5de29b
 update-abi-%: $(common-objpfx)%.symlist %.abilist
5de29b
 	$(update-abi)
5de29b
+define update-abi-pattern
5de29b
+@if cmp -s $^ 2> /dev/null; \
5de29b
+ then \
5de29b
+      echo '+++ $(filter $(abilist-pattern),$^) is unchanged'; \
5de29b
+ else cp -f $^; \
5de29b
+      echo '*** Now check $(filter $(abilist-pattern),$^) changes for correctness ***'; \
5de29b
+ fi
5de29b
+endef
5de29b
 define update-abi
5de29b
 @if cmp -s $^ 2> /dev/null; \
5de29b
  then \
12745e
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/Makefile glibc-2.17-c758a686/sysdeps/powerpc/Makefile
12745e
--- glibc-2.17-c758a686/sysdeps/powerpc/Makefile	2014-06-02 15:29:42.000000000 +0000
12745e
+++ glibc-2.17-c758a686/sysdeps/powerpc/Makefile	2014-06-02 15:25:21.000000000 +0000
5de29b
@@ -27,3 +27,7 @@
5de29b
 sysdep_headers += sys/platform/ppc.h
5de29b
 tests += test-gettimebase
5de29b
 endif
5de29b
+
5de29b
+ifneq (,$(filter %le,$(config-machine)))
5de29b
+abilist-pattern = %-le.abilist
5de29b
+endif