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