From bc2b9c015f6091052d9e77a87bcf8ae4d735a784 Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Tue, 5 Mar 2019 04:16:50 +0000 Subject: [PATCH] Fix binutils compilation error with Clang 8 Summary: This change fixes the following compilation error when using clang 8 to cross compile base to powerpc64: ``` /usr/src/gnu/usr.bin/binutils/libopcodes/../../../../contrib/binutils/opcodes/ppc-dis.c:100:35: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic] info->private_data = (char *) 0 + dialect; ~~~~~~~~~~ ^ 1 error generated. *** [ppc-dis.o] Error code 1 make[6]: stopped in /usr/src/gnu/usr.bin/binutils/libopcodes 1 error ``` Test Plan: - buildworld for x86_64 (native) - buildworld for powerpc64 (cross) - buildworld for powerpc64 (native) Submitted by: alfredo.junior_eldorado.org.br Reviewed By: emaste, pfg, brooks Differential Revision: https://reviews.freebsd.org/D19235 --- contrib/binutils/opcodes/ppc-dis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/binutils/opcodes/ppc-dis.c b/contrib/binutils/opcodes/ppc-dis.c index 2545a36f21a..3fe78163ad0 100644 --- a/contrib/binutils/opcodes/ppc-dis.c +++ b/contrib/binutils/opcodes/ppc-dis.c @@ -20,6 +20,7 @@ along with this file; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include +#include #include "sysdep.h" #include "dis-asm.h" #include "opcode/ppc.h" @@ -97,7 +98,7 @@ powerpc_dialect (struct disassemble_info *info) dialect |= PPC_OPCODE_64; } - info->private_data = (char *) 0 + dialect; + info->private_data = (void *)(uintptr_t)dialect; return dialect; }