open-plc-utils: new package
[buildroot-gz.git] / package / lightning / 0002-ppc-disassembler-build-fix.patch
blob4c812b3a7f81ba7b547c458e4cabb87ce89662d0
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.
8 ---
9 diff --git a/configure.ac b/configure.ac
10 index 749659b..d26e777 100644
11 --- a/configure.ac
12 +++ b/configure.ac
13 @@ -230,6 +230,13 @@ elif test $cpu = arm; then
14 return 1;
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
19 + save_LIBS="$LIBS"
20 + LIBS="$LIBS $SHLIB"
21 + AC_CHECK_FUNCS(disassemble_init_for_target disassemble_init_powerpc)
22 + LIBS="$save_LIBS"
23 + fi
25 CFLAGS=$save_CFLAGS
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);
39 +# endif
40 # if defined(__powerpc64__)
41 disasm_info.disassembler_options = "64";
42 # endif
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);
47 +# endif
48 # endif
49 # if defined(__sparc__)
50 disasm_info.endian = disasm_info.display_endian = BFD_ENDIAN_BIG;
51 --
52 2.1.4