Message ID | CAP045ApGo8tPc=97OqrVG4S9GiAP+T1k0ftrP2L3f-kpCDSdJg@mail.gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 127838 invoked by alias); 27 Mar 2015 20:55:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 127825 invoked by uid 89); 27 Mar 2015 20:55:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-qg0-f47.google.com Received: from mail-qg0-f47.google.com (HELO mail-qg0-f47.google.com) (209.85.192.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 27 Mar 2015 20:55:18 +0000 Received: by qgh3 with SMTP id 3so129024146qgh.2 for <gdb-patches@sourceware.org>; Fri, 27 Mar 2015 13:55:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=14RXEFtFqAFdktvsqMjDbmv6ccsoY4puJaxm8M2AwqA=; b=dIg8esksH0LFoiMC5yKK3HsU47hdl/DKKOudT+YEQNLtiiYq/3T08YvvPh2fDS7q14 IBsmrKzkhW+gn0bmzMVQ0ccvpCDQIJoC+Jb35mocmCFVUocBaxxHwTI2tN+O67cDsv80 Q0x25WuRfFQiXIOjK4Q9gjDB7iIlvQUfbRWJ3D878FKfl312Nf0lMnhKnNr9yl96Uykk oV3Vw75Gpj5dDcFw3aMoAP4hRZpVg7V749mBcCN7qtKx2MDgXmkoS0ZhqwnHscThV0HL X153OM+ZX0ju9tSfaZH38Qucz3ceX2wJ8fV3KJ6fPo+QAJJqZs33u/h8deiZ5VA8InA/ ZqgQ== X-Gm-Message-State: ALoCoQlcj+0fNu7sISibBjLfjIr6YW+i1iw9RD2bpfWl2l43vdduOzjKF2uquL3nNIKqscLgcvM+ MIME-Version: 1.0 X-Received: by 10.140.235.200 with SMTP id g191mr21591897qhc.42.1427489716523; Fri, 27 Mar 2015 13:55:16 -0700 (PDT) Received: by 10.96.26.42 with HTTP; Fri, 27 Mar 2015 13:55:16 -0700 (PDT) Date: Fri, 27 Mar 2015 13:55:16 -0700 Message-ID: <CAP045ApGo8tPc=97OqrVG4S9GiAP+T1k0ftrP2L3f-kpCDSdJg@mail.gmail.com> Subject: [PATCH] Do arm_abi detection for ELFOSABI_GNU binaries From: Kyle Huey <me@kylehuey.com> To: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8 |
Commit Message
Kyle Huey
March 27, 2015, 8:55 p.m. UTC
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(-) /* Assume GNU tools. */
Comments
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
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.
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
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".
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
Kyle Huey <me@kylehuey.com> writes: > Thanks for reviewing! I do not have a sourceware account, so that > would be greatly appreciated. I pushed this patch in. Thanks for reminding me... I thought I did push it in already :)
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: