diff --git a/tzcnt-lzcnt-inst.diff b/tzcnt-lzcnt-inst.diff new file mode 100644 index 0000000..55af851 --- /dev/null +++ b/tzcnt-lzcnt-inst.diff @@ -0,0 +1,28 @@ +GCC 4.8 emits TZCNT (== REP; BSF), expecting that older CPUs behave +like BSF and on newer CPUs as TZCNT. + +This patch makes the intrstructions known to valgrind. +Cf. https://bugs.kde.org/show_bug.cgi?id=295808 + +--- VEX/priv/guest_amd64_toIR.c.orig 2011-10-26 23:24:49.000000000 +0200 ++++ VEX/priv/guest_amd64_toIR.c 2012-08-17 11:38:20.000000000 +0200 +@@ -17946,11 +17946,17 @@ DisResult disInstr_AMD64_WRK ( + /* =-=-=-=-=-=-=-=-=- BSF/BSR -=-=-=-=-=-=-=-=-=-= */ + + case 0xBC: /* BSF Gv,Ev */ +- if (haveF2orF3(pfx)) goto decode_failure; ++ if (haveF2(pfx)) goto decode_failure; ++ /* Treat TZCNT (= F3 0F BC = REP; BSF) as BSF ++ as required for old cpus - and for new ones as ++ valgrind doesn't handle TZCNT yet. */ + delta = dis_bs_E_G ( vbi, pfx, sz, delta, True ); + break; + case 0xBD: /* BSR Gv,Ev */ +- if (haveF2orF3(pfx)) goto decode_failure; ++ if (haveF2(pfx)) goto decode_failure; ++ /* Treat LZCNT (= F3 0F BD = REP; BSR) as BSR ++ as required for old cpus - and for new ones as ++ valgrind doesn't handle LZCNT yet. */ + delta = dis_bs_E_G ( vbi, pfx, sz, delta, False ); + break; + diff --git a/valgrind.changes b/valgrind.changes index 06fdc54..553e4c9 100644 --- a/valgrind.changes +++ b/valgrind.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Aug 17 09:39:39 UTC 2012 - burnus@net-b.de + +- Support TZCNT/LZCNT instructions, generated by GCC 4.8, + by falling back to BSF/BSR. (bnc#776211) + ------------------------------------------------------------------- Sun Jul 22 06:31:31 UTC 2012 - aj@suse.de diff --git a/valgrind.spec b/valgrind.spec index afb5aef..c988a89 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -42,6 +42,8 @@ Patch1: jit-register-unregister.diff Patch2: glibc.diff # added automake 1.11.2 patch https://bugs.kde.org/show_bug.cgi?id=290719 algrind-3.7.0-automake-1.11.2.patch Patch3: valgrind-3.7.0-automake-1.11.2.patch +# added GCC 4.8 patch https://bugs.kde.org/show_bug.cgi?id=295808 +Patch4: tzcnt-lzcnt-inst.diff # during building the major version of glibc is built into the suppression file %define glibc_main_version %(getconf GNU_LIBC_VERSION | cut -d' ' -f2 | cut -d. -f1) %define glibc_major_version %(getconf GNU_LIBC_VERSION | cut -d' ' -f2 | cut -d. -f2) @@ -141,6 +143,7 @@ cd .. %patch1 %patch2 %patch3 -p1 +%patch4 %build %ifarch %arm