* [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries
@ 2015-03-27 20:55 Kyle Huey
2015-04-16 17:15 ` Kyle Huey
2015-04-17 8:41 ` Yao Qi
0 siblings, 2 replies; 7+ messages in thread
From: Kyle Huey @ 2015-03-27 20:55 UTC (permalink / raw)
To: gdb-patches
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/ChangeLog:
* gdb/arm-tdep.c (arm_gdbarch_init): Perform arm_abi detection on
ELFOSABI_GNU binaries.
---
gdb/arm-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 630a207..830739e 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -9948,17 +9948,17 @@ arm_gdbarch_init (struct gdbarch_info info,
struct gdbarch_list *arches)
if (ei_osabi == ELFOSABI_ARM)
{
/* GNU tools used to use this value, but do not for EABI
objects. There's nowhere to tag an EABI version
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;
switch (eabi_ver)
{
case EF_ARM_EABI_UNKNOWN:
/* Assume GNU tools. */
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries
2015-03-27 20:55 [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries Kyle Huey
@ 2015-04-16 17:15 ` Kyle Huey
2015-04-17 8:41 ` Yao Qi
1 sibling, 0 replies; 7+ messages in thread
From: Kyle Huey @ 2015-04-16 17:15 UTC (permalink / raw)
To: gdb-patches
On Fri, Mar 27, 2015 at 1:55 PM, Kyle Huey <me@kylehuey.com> wrote:
> 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/ChangeLog:
> * gdb/arm-tdep.c (arm_gdbarch_init): Perform arm_abi detection on
> ELFOSABI_GNU binaries.
> ---
> gdb/arm-tdep.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
> index 630a207..830739e 100644
> --- a/gdb/arm-tdep.c
> +++ b/gdb/arm-tdep.c
> @@ -9948,17 +9948,17 @@ arm_gdbarch_init (struct gdbarch_info info,
> struct gdbarch_list *arches)
>
> if (ei_osabi == ELFOSABI_ARM)
> {
> /* GNU tools used to use this value, but do not for EABI
> objects. There's nowhere to tag an EABI version
> 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;
>
> switch (eabi_ver)
> {
> case EF_ARM_EABI_UNKNOWN:
> /* Assume GNU tools. */
Bump. Has anyone had a chance to review this?
- Kyle
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries
2015-03-27 20:55 [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries Kyle Huey
2015-04-16 17:15 ` Kyle Huey
@ 2015-04-17 8:41 ` Yao Qi
2015-05-08 17:12 ` Kyle Huey
1 sibling, 1 reply; 7+ messages in thread
From: Yao Qi @ 2015-04-17 8:41 UTC (permalink / raw)
To: Kyle Huey; +Cc: gdb-patches
Kyle Huey <me@kylehuey.com> writes:
Hi Kyle,
> 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)
Thanks for submitting the patch... Looks GDB doesn't detect the correct
abi in your case, but you can set arm abi explicitly via "set arm abi AAPCS".
Hope this can unblock you. In the mean time, I'll think about your patch.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries
2015-04-17 8:41 ` Yao Qi
@ 2015-05-08 17:12 ` Kyle Huey
2015-05-19 9:41 ` Yao Qi
0 siblings, 1 reply; 7+ messages in thread
From: Kyle Huey @ 2015-05-08 17:12 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On Fri, Apr 17, 2015 at 1:41 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> Kyle Huey <me@kylehuey.com> writes:
>
> Hi Kyle,
>
>> 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)
>
> Thanks for submitting the patch... Looks GDB doesn't detect the correct
> abi in your case, but you can set arm abi explicitly via "set arm abi AAPCS".
> Hope this can unblock you. In the mean time, I'll think about your patch.
>
> --
> Yao (齐尧)
Hello Yao,
Thank you for the tip. Have you had a chance to look at the patch?
- Kyle
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries
2015-05-08 17:12 ` Kyle Huey
@ 2015-05-19 9:41 ` Yao Qi
2015-05-19 14:04 ` Kyle Huey
0 siblings, 1 reply; 7+ messages in thread
From: Yao Qi @ 2015-05-19 9:41 UTC (permalink / raw)
To: Kyle Huey; +Cc: Yao Qi, gdb-patches
Kyle Huey <me@kylehuey.com> writes:
> Thank you for the tip. Have you had a chance to look at the patch?
Hi Kyle,
Sorry for the delayed reply. I spent some hours investigating how this
patch break some cases, but can't find any one. I also take a look at
code in binutils, and find the code pattern
"e_ident[EI_OSABI] == ELFOSABI_GNU || e_ident[EI_OSABI] == ELFOSABI_NONE"
is used here and there.
This patch is OK to commit. If you don't have a sourceware account to
push your commit in, I can do it for you. Your patch is just one line,
so it can be pushed in as a "tiny patch".
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries
2015-05-19 9:41 ` Yao Qi
@ 2015-05-19 14:04 ` Kyle Huey
2015-05-28 8:19 ` Yao Qi
0 siblings, 1 reply; 7+ messages in thread
From: Kyle Huey @ 2015-05-19 14:04 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On Tue, May 19, 2015 at 2:41 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> Kyle Huey <me@kylehuey.com> writes:
>
>> Thank you for the tip. Have you had a chance to look at the patch?
>
> Hi Kyle,
> Sorry for the delayed reply. I spent some hours investigating how this
> patch break some cases, but can't find any one. I also take a look at
> code in binutils, and find the code pattern
> "e_ident[EI_OSABI] == ELFOSABI_GNU || e_ident[EI_OSABI] == ELFOSABI_NONE"
> is used here and there.
>
> This patch is OK to commit. If you don't have a sourceware account to
> push your commit in, I can do it for you. Your patch is just one line,
> so it can be pushed in as a "tiny patch".
>
> --
> Yao (齐尧)
Thanks for reviewing! I do not have a sourceware account, so that
would be greatly appreciated.
Thanks,
- Kyle
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-05-28 8:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-27 20:55 [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries Kyle Huey
2015-04-16 17:15 ` Kyle Huey
2015-04-17 8:41 ` Yao Qi
2015-05-08 17:12 ` Kyle Huey
2015-05-19 9:41 ` Yao Qi
2015-05-19 14:04 ` Kyle Huey
2015-05-28 8:19 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).