]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Patch 1 of 7, improve PPC HW capabiltiy checking.
authorCarl Love <cel@us.ibm.com>
Mon, 20 Jul 2015 18:53:56 +0000 (18:53 +0000)
committerCarl Love <cel@us.ibm.com>
Mon, 20 Jul 2015 18:53:56 +0000 (18:53 +0000)
The patch was submitted by Will Schmidt  (will_schmidt@vnet.ibm.com).

Add generic (ppc64) aux vector capability checking script.
This consolidates several of the existing _cap checking scripts.

Bugzilla 34979

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15420

tests/Makefile.am
tests/check_ppc64_auxv_cap [new file with mode: 0644]

index b01cfb7f502e85d2756d2f8089497735fc030eaa..07f3d6463883e13503c04d2d1139e0827a58f8cc 100644 (file)
@@ -8,6 +8,7 @@ dist_noinst_SCRIPTS = \
        check_makefile_consistency \
        check_dfp_cap \
        check_vmx_cap \
+       check_ppc64_auxv_cap \
        filter_addresses \
        filter_discards \
        filter_libc \
diff --git a/tests/check_ppc64_auxv_cap b/tests/check_ppc64_auxv_cap
new file mode 100644 (file)
index 0000000..49d7856
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# Check if the passed in (CAPABILITY_WORD) matches a value found in the
+# current hwcap aux vector.
+
+# return '0' to indicate the capability was found.
+# return '1' for not found, or any other error condition.
+
+CAPABILITY_WORD=$1
+
+# SANITY CHECK Begin:
+# These are potential hwcap values as found in the glibc dl-procinfo.c
+# sources as of July 2015.
+P_HWCAP_1=" vsx arch_2_06 power6x dfp pa6t arch_2_05 ic_snoop smt booke"
+P_HWCAP_2=" cellbe power5+ power5 power4 notb efpdouble efpsingle spe"
+P_HWCAP_3=" ucache 4xxmac mmu fpu altivec ppc601 ppc64 ppc32 "
+P_HWCAP2_1=" tar isel ebb dscr htm arch_2_07 "
+CAPABILITY_FOUND="no"
+for POTENTIAL_CAP in $P_HWCAP_1 $P_HWCAP_2 $P_HWCAP_3 $P_HWCAP2_1 ; do
+       if [ "x$CAPABILITY_WORD" = "x$POTENTIAL_CAP" ]; then
+               CAPABILITY_FOUND="yes"
+               break
+       fi
+done
+if [ x$CAPABILITY_FOUND = "xno" ]; then
+       echo "Warning: did not find $CAPABILITY_WORD in the potential capabilities list."
+       echo "         LD_SHOW_AUXV=1 /bin/true | grep ^AT_HWCAP "
+       echo "         Double-check that the input value [$CAPABILITY_WORD] is valid."
+fi
+# SANITY CHECK End
+
+# Capability Check Begin:
+LD_SHOW_AUXV=1 /bin/true | grep ^AT_HWCAP | grep -w $CAPABILITY_WORD 2>&1 > /dev/null
+if [ "$?" -eq "0" ]; then
+       #echo "found the capability"
+       exit 0
+elif [ "$?" -eq "2" ]; then
+       # echo "grep failure"
+       exit 1
+else
+       #echo "did not find the capability"
+       exit 1
+fi
+