1 From 361caf28545aa0c2b2ab8d1cbd334fbdd952f373 Mon Sep 17 00:00:00 2001
2 From: Paulo Andrade <pcpa@gnu.org>
3 Date: Thu, 15 Jan 2015 14:56:38 -0200
4 Subject: [PATCH 4/4] PPC: Only call binutils function if it is available
6 * configure.ac, lib/jit_disasm.c: Rewrite workaround
7 to apparent problem to initialize powerpc disassembler.
9 diff --git a/configure.ac b/configure.ac
10 index 749659b..d26e777 100644
13 @@ -230,6 +230,13 @@ elif test $cpu = arm; then
16 ]])],[ac_cv_test_arm_swf=yes],[],[ac_cv_test_arm_swf=no])
17 +elif test $cpu = ppc; then
18 + if test "x$DISASSEMBLER" != "xno"; then
21 + AC_CHECK_FUNCS(disassemble_init_for_target disassemble_init_powerpc)
27 diff --git a/lib/jit_disasm.c b/lib/jit_disasm.c
28 index 01158de..86e5441 100644
29 --- a/lib/jit_disasm.c
30 +++ b/lib/jit_disasm.c
31 @@ -91,11 +91,19 @@ jit_init_debug(const char *progname)
32 # if defined(__powerpc__)
33 disasm_info.arch = bfd_arch_powerpc;
34 disasm_info.mach = bfd_mach_ppc64;
35 +# if HAVE_DISASSEMBLE_INIT_FOR_TARGET
36 + disassemble_init_for_target(&disasm_info);
37 +# elif HAVE_DISASSEMBLE_INIT_POWERPC
38 disassemble_init_powerpc(&disasm_info);
40 # if defined(__powerpc64__)
41 disasm_info.disassembler_options = "64";
43 +# if HAVE_DISASSEMBLE_INIT_FOR_TARGET
44 + disassemble_init_for_target(&disasm_info);
45 +# elif HAVE_DISASSEMBLE_INIT_POWERPC
46 disassemble_init_powerpc(&disasm_info);
49 # if defined(__sparc__)
50 disasm_info.endian = disasm_info.display_endian = BFD_ENDIAN_BIG;