From d403db2720ef6ac091dd1c0101ffc60242199528 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Thu, 28 May 2015 09:12:12 +0100 Subject: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries On ARM systems, gdb must determine which style of breakpoint to use (see the comments at the beginning of gdb/arm-linux-tdep.c). In arm_gdbarch_init we only attempt to extract the eabi version from the ELF binary if it is a ELFOSABI_NONE binary. If the binary is ELFOSABI_GNU instead, we end up defaulting to the old style OABI syscall breakpoint instruction. On a Linux kernel built without CONFIG_OABI_COMPAT, this triggers a SIGILL in ld when attempting to execute any ELFOSABI_GNU program. (e.g. https://github.com/raspberrypi/linux/issues/766) gdb/ 2015-05-28 Kyle Huey (tiny patch) * gdb/arm-tdep.c (arm_gdbarch_init): Perform arm_abi detection on ELFOSABI_GNU binaries. --- gdb/ChangeLog | 5 +++++ gdb/arm-tdep.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 971187fd065..a75d3bb8d01 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-05-28 Kyle Huey (tiny patch) + + * gdb/arm-tdep.c (arm_gdbarch_init): Perform arm_abi detection on + ELFOSABI_GNU binaries. + 2015-05-27 Doug Evans * dwarf2read.c (lnp_state_machine): New typedef. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 638855b718f..750749d5fd9 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -9950,7 +9950,7 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) anyway, so assume APCS. */ arm_abi = ARM_ABI_APCS; } - else if (ei_osabi == ELFOSABI_NONE) + else if (ei_osabi == ELFOSABI_NONE || ei_osabi == ELFOSABI_GNU) { int eabi_ver = EF_ARM_EABI_VERSION (e_flags); int attr_arch, attr_profile; -- 2.30.2