public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "mikpe at it dot uu dot se" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/40860] [4.4/4.5 regression] regressions in libjava testsuite on arm-linux
Date: Sat, 20 Mar 2010 22:36:00 -0000	[thread overview]
Message-ID: <20100320223620.5800.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40860-5724@http.gcc.gnu.org/bugzilla/>



------- Comment #26 from mikpe at it dot uu dot se  2010-03-20 22:36 -------
Created an attachment (id=20147)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20147&action=view)
test program to take a stack trace using _Unwind_ API

I'm attaching a test program which sets up a predictable call chain, and then
uses _Unwind_Backtrace() and _Unwind_GetRegionStart() to get the entry points
of the functions in the call chain into an array. It prints the corresponding
function names and verifies that the function entry points are correct.

With gcc-4.4.3 and binutils-2.19.1 on armv5tel-unknown-linux-gnueabi this works
fine:

> gcc -funwind-tables -fno-unit-at-a-time -O -o stacktrace-2.19.1 stacktrace.c
> ./stacktrace-2.19.1 
bar
f2
main

With the same gcc binary but binutils-20100316 the program fails:

> PATH=/tmp/binutils-2.20.51-install/bin:$PATH gcc -funwind-tables -fno-unit-at-a-time -O stacktrace.c -o stacktrace-2.20.51
> ./stacktrace-2.20.51 
bar
f1
f1
Abort

The reason for the failure is that ld merged the .ARM.exidx entries for f2 and
main with the one for f1, which breaks _Unwind_GetRegionStart(). First we see
that f1, f2, and main are adjacent in memory:

> nm -v stacktrace-2.20.51
...
00008588 T tracefn
000085bc T bar
0000865c T f1
0000866c T f2
0000867c T main
00008698 T __libc_csu_fini
...

With binutils-2.19.1 they each get their own .ARM.exidx entry:

> /tmp/binutils-2.20.51-install/bin/readelf --unwind stacktrace-2.19.1 

Unwind table index '.ARM.exidx' at offset 0x778 contains 7 entries:

0x845c <_start>: 0x1 [cantunwind]

0x8508 <printf_fn>: 0x80a8b0b0
  Compact model 0
  0xa8      pop {r4r14}
  0xb0      finish
  0xb0      finish

0x8588 <tracefn>: 0x80aab0b0
  Compact model 0
  0xaa      pop {r4, r5, r6r14}
  0xb0      finish
  0xb0      finish

0x85bc <bar>: 0x8003a8b0
  Compact model 0
  0x03      vsp = vsp + 16
  0xa8      pop {r4r14}
  0xb0      finish

0x865c <f1>: 0x80a8b0b0
  Compact model 0
  0xa8      pop {r4r14}
  0xb0      finish
  0xb0      finish

0x866c <f2>: 0x80a8b0b0
  Compact model 0
  0xa8      pop {r4r14}
  0xb0      finish
  0xb0      finish

0x867c <main>: 0x80a8b0b0
  Compact model 0
  0xa8      pop {r4r14}
  0xb0      finish
  0xb0      finish

But with binutils-20100316 f2 and main don't have their own entries, so PCs in
them are reported as belonging to f1 instead:

> /tmp/binutils-2.20.51-install/bin/readelf --unwind stacktrace-2.20.51 

Unwind table index '.ARM.exidx' at offset 0x778 contains 6 entries:

0x845c <_start>: 0x1 [cantunwind]

0x8508 <printf_fn>: 0x80a8b0b0
  Compact model 0
  0xa8      pop {r4r14}
  0xb0      finish
  0xb0      finish

0x8588 <tracefn>: 0x80aab0b0
  Compact model 0
  0xaa      pop {r4, r5, r6r14}
  0xb0      finish
  0xb0      finish

0x85bc <bar>: 0x8003a8b0
  Compact model 0
  0x03      vsp = vsp + 16
  0xa8      pop {r4r14}
  0xb0      finish

0x865c <f1>: 0x80a8b0b0
  Compact model 0
  0xa8      pop {r4r14}
  0xb0      finish
  0xb0      finish

0x8698 <__libc_csu_fini>: 0x1 [cantunwind]

This test program also works on i686-linux, sparc64-linux -m32/-m64, and
powerpc64-linux -m32.

I understand the benefits of shrinking .ARM.exidx tables, but it does break
parts of gcc's <unwind.h> implementation (and thus libjava), so should be
opt-in via an explicit option and not done by default.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40860


  parent reply	other threads:[~2010-03-20 22:36 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-26 10:51 [Bug libgcj/40860] New: " debian-gcc at lists dot debian dot org
2009-07-29 23:07 ` [Bug libgcj/40860] " jsm28 at gcc dot gnu dot org
2009-10-15 12:54 ` jakub at gcc dot gnu dot org
2010-01-21 13:16 ` jakub at gcc dot gnu dot org
2010-01-24 16:04 ` mikpe at it dot uu dot se
2010-01-25  9:33 ` mikpe at it dot uu dot se
2010-02-03 14:51 ` mikpe at it dot uu dot se
2010-02-05 15:40 ` mikpe at it dot uu dot se
2010-02-06 15:36 ` mikpe at it dot uu dot se
2010-02-13 20:49 ` mikpe at it dot uu dot se
2010-02-15 15:32 ` doko at ubuntu dot com
2010-02-15 22:26 ` mikpe at it dot uu dot se
2010-02-16 16:34 ` doko at ubuntu dot com
2010-02-19 23:32 ` mikpe at it dot uu dot se
2010-02-22 21:49 ` mikpe at it dot uu dot se
2010-02-28 10:07 ` aph at gcc dot gnu dot org
2010-03-04 10:17 ` mikpe at it dot uu dot se
2010-03-15  9:09 ` mikpe at it dot uu dot se
2010-03-15  9:16 ` rearnsha at gcc dot gnu dot org
2010-03-16 13:42 ` doko at ubuntu dot com
2010-03-16 17:29 ` mikpe at it dot uu dot se
2010-03-16 23:30 ` doko at ubuntu dot com
2010-03-16 23:39 ` mikpe at it dot uu dot se
2010-03-17 10:51 ` doko at ubuntu dot com
2010-03-17 21:13 ` mikpe at it dot uu dot se
2010-03-17 21:23 ` mikpe at it dot uu dot se
2010-03-19 23:20 ` mikpe at it dot uu dot se
2010-03-20 18:54 ` ramana at gcc dot gnu dot org
2010-03-20 22:10 ` mikpe at it dot uu dot se
2010-03-20 22:36 ` mikpe at it dot uu dot se [this message]
2010-03-22 23:48 ` rearnsha at gcc dot gnu dot org
2010-03-30 13:21 ` mikpe at it dot uu dot se
2010-03-30 14:04 ` pbrook at gcc dot gnu dot org
2010-03-30 15:09 ` mikpe at it dot uu dot se
2010-03-31  8:47 ` rearnsha at gcc dot gnu dot org
2010-03-31 21:44 ` mikpe at it dot uu dot se
2010-04-08 12:14 ` [Bug libgcj/40860] [4.4/4.5/4.6 " mikpe at it dot uu dot se
2010-04-12 19:03 ` mikpe at it dot uu dot se
2010-04-13 16:36 ` aph at gcc dot gnu dot org
2010-04-13 16:52 ` mikpe at it dot uu dot se
2010-04-13 17:02 ` aph at redhat dot com
2010-04-13 17:25 ` aph at gcc dot gnu dot org
2010-04-21 16:34 ` aph at gcc dot gnu dot org
2010-04-21 17:05 ` aph at gcc dot gnu dot org
2010-04-22 16:07 ` aph at gcc dot gnu dot org
2010-04-22 16:08 ` aph at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100320223620.5800.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).