From fe2934bd59e7a1dbe58dafcd71bb8383505de092 Mon Sep 17 00:00:00 2001 From: Robert Swiecki Date: Mon, 4 Sep 2017 15:23:14 +0200 Subject: [PATCH] Use different disassbler() prototype from binutils in case of >= 2.29 --- linux/bfd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/linux/bfd.c b/linux/bfd.c index bcd247f7..f3e9b0b0 100644 --- a/linux/bfd.c +++ b/linux/bfd.c @@ -46,6 +46,14 @@ typedef struct { asymbol **syms; } bfd_t; +/* + * This is probably the only define which was added with binutils 2.29, so we us + * it, do decide which disassembler() prototype from dis-asm.h to use + */ +#if defined(FOR_EACH_DISASSEMBLER_OPTION) +#define _HF_BFD_GE_2_29 +#endif + static pthread_mutex_t arch_bfd_mutex = PTHREAD_MUTEX_INITIALIZER; static bool arch_bfdInit(pid_t pid, bfd_t * bfdParams) @@ -160,8 +168,12 @@ void arch_bfdDisasm(pid_t pid, uint8_t * mem, size_t size, char *instr) LOG_W("bfd_check_format() failed"); return; } - +#if defined(_HF_BFD_GE_2_29) + disassembler_ftype disassemble = + disassembler(bfd_get_arch(bfdh), bfd_little_endian(bfdh) ? FALSE : TRUE, 0, NULL); +#else disassembler_ftype disassemble = disassembler(bfdh); +#endif // defined(_HD_BFD_GE_2_29) if (disassemble == NULL) { LOG_W("disassembler() failed"); return;