From 499cded4a116bd94efc1992baa4a2fe596116846 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 15 Sep 2014 14:46:00 +0200 Subject: [PATCH] 3.10.0-3 - Add valgrind-3.10.0-old-ppc32-instr-magic.patch. --- valgrind-3.10.0-old-ppc32-instr-magic.patch | 31 +++++++++++++++++++++ valgrind.spec | 10 ++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 valgrind-3.10.0-old-ppc32-instr-magic.patch diff --git a/valgrind-3.10.0-old-ppc32-instr-magic.patch b/valgrind-3.10.0-old-ppc32-instr-magic.patch new file mode 100644 index 0000000..8252e33 --- /dev/null +++ b/valgrind-3.10.0-old-ppc32-instr-magic.patch @@ -0,0 +1,31 @@ +diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c +index adabf64..8f7e4aa 100644 +--- a/VEX/priv/guest_ppc_toIR.c ++++ b/VEX/priv/guest_ppc_toIR.c +@@ -18783,10 +18783,26 @@ DisResult disInstr_PPC_WRK ( + UInt word2 = mode64 ? 0x78006800 : 0x5400683E; + UInt word3 = mode64 ? 0x7800E802 : 0x5400E83E; + UInt word4 = mode64 ? 0x78009802 : 0x5400983E; ++ Bool is_special_preamble = False; + if (getUIntPPCendianly(code+ 0) == word1 && + getUIntPPCendianly(code+ 4) == word2 && + getUIntPPCendianly(code+ 8) == word3 && + getUIntPPCendianly(code+12) == word4) { ++ is_special_preamble = True; ++ } else if (! mode64 && ++ getUIntPPCendianly(code+ 0) == 0x54001800 && ++ getUIntPPCendianly(code+ 4) == 0x54006800 && ++ getUIntPPCendianly(code+ 8) == 0x5400E800 && ++ getUIntPPCendianly(code+12) == 0x54009800) { ++ static Bool reported = False; ++ if (!reported) { ++ vex_printf("disInstr(ppc): old ppc32 instruction magic detected. Code might clobber r0.\n"); ++ vex_printf("disInstr(ppc): source needs to be recompiled against latest valgrind.h.\n"); ++ reported = True; ++ } ++ is_special_preamble = True; ++ } ++ if (is_special_preamble) { + /* Got a "Special" instruction preamble. Which one is it? */ + if (getUIntPPCendianly(code+16) == 0x7C210B78 /* or 1,1,1 */) { + /* %R3 = client_request ( %R4 ) */ diff --git a/valgrind.spec b/valgrind.spec index f91b6a3..c71415f 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Tool for finding memory management bugs in programs Name: %{?scl_prefix}valgrind Version: 3.10.0 -Release: 2%{?dist} +Release: 3%{?dist} Epoch: 1 License: GPLv2+ URL: http://www.valgrind.org/ @@ -58,6 +58,10 @@ Patch3: valgrind-3.9.0-stat_h.patch # Make ld.so supressions slightly less specific. Patch4: valgrind-3.9.0-ldso-supp.patch +# Recognize and warn about usage of old (broken) ppc32 magic instr preamble. +# https://bugs.kde.org/show_bug.cgi?id=278808#c6 +Patch5: valgrind-3.10.0-old-ppc32-instr-magic.patch + %if %{build_multilib} # Ensure glibc{,-devel} is installed for both multilib arches BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so @@ -160,6 +164,7 @@ Valgrind User Manual for details. %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build # We need to use the software collection compiler and binutils if available. @@ -308,6 +313,9 @@ echo ===============END TESTING=============== %endif %changelog +* Mon Sep 15 2014 Mark Wielaard - 3.10.0-3 +- Add valgrind-3.10.0-old-ppc32-instr-magic.patch. + * Fri Sep 12 2014 Mark Wielaard - 3.10.0-2 - Fix ppc32 multilib handling on ppc64[be]. - Drop ppc64 secondary for ppc32 primary support.