Jan Kratochvil 4a848eb
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
Jan Kratochvil 4a848eb
From: Jan Kratochvil <jan.kratochvil@redhat.com>
Jan Kratochvil 4a848eb
Date: Sun, 4 Feb 2018 21:42:18 +0100
Jan Kratochvil 4a848eb
Subject: gdb-ppc64-stwux-tautological-compare.patch
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
;; Fix ppc64 stwux encoding as found by gcc-8.0 -Werror=tautological-compare.
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
[patch] ppc64: Fix stwux encoding
Jan Kratochvil 4a848eb
https://sourceware.org/ml/gdb-patches/2018-02/msg00058.html
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
with gcc-8.0.1-0.9.fc28.x86_64 I get:
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
../../gdb/rs6000-tdep.c: In function 'CORE_ADDR skip_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, rs6000_framedata*)':
Jan Kratochvil 4a848eb
../../gdb/rs6000-tdep.c:1911:34: error: bitwise comparison always evaluates to false [-Werror=tautological-compare]
Jan Kratochvil 4a848eb
       else if ((op & 0xfc1f016a) == 0x7c01016e)
Jan Kratochvil 4a848eb
                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
The code is there since:
Jan Kratochvil 4a848eb
	commit 98f08d3d9b69b344bb8b0cd2a4bda1cf4d966e20
Jan Kratochvil 4a848eb
	Author: Kevin Buettner <kevinb@redhat.com>
Jan Kratochvil 4a848eb
	Date:   Thu May 29 19:47:14 2003 +0000
Jan Kratochvil 4a848eb
		    From Jimi X <jimix@watson.ibm.com>:
Jan Kratochvil 4a848eb
		    * rs6000-tdep.c (skip_prologue): Improve support for 64-bit code.
Jan Kratochvil 4a848eb
So I do not think we can find the original author.
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.alangref/idalangref_stwux_stux_instrs.htm
Jan Kratochvil 4a848eb
says
Jan Kratochvil 4a848eb
	bit 21 - 30 = 183
Jan Kratochvil 4a848eb
	Those are bits 1..10 in normal bit order: 183<<1 = 0x16e
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
gdb/ChangeLog
Jan Kratochvil 4a848eb
2018-02-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
	* rs6000-tdep.c (skip_prologue): Fix stwux encoding.
Jan Kratochvil 4a848eb
Jan Kratochvil 4a848eb
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
Jan Kratochvil 4a848eb
--- a/gdb/rs6000-tdep.c
Jan Kratochvil 4a848eb
+++ b/gdb/rs6000-tdep.c
Jan Kratochvil 4a848eb
@@ -1908,7 +1908,7 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc,
Jan Kratochvil 4a848eb
 	  offset = fdata->offset;
Jan Kratochvil 4a848eb
 	  continue;
Jan Kratochvil 4a848eb
 	}
Jan Kratochvil 4a848eb
-      else if ((op & 0xfc1f016a) == 0x7c01016e)
Jan Kratochvil 4a848eb
+      else if ((op & 0xfc1f016e) == 0x7c01016e)
Jan Kratochvil 4a848eb
 	{			/* stwux rX,r1,rY */
Jan Kratochvil 4a848eb
 	  /* No way to figure out what r1 is going to be.  */
Jan Kratochvil 4a848eb
 	  fdata->frameless = 0;