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: Tue, 30 Mar 2010 13:21:00 -0000	[thread overview]
Message-ID: <20100330132111.20840.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40860-5724@http.gcc.gnu.org/bugzilla/>



------- Comment #28 from mikpe at it dot uu dot se  2010-03-30 13:21 -------
I've looked at the amount of .ARM.exidx entry merging being done and its
consequences for the various unwinders in gcc.  Currently only table entries
with immediate (inlined) data are merged, and for that all of gcc except for
libjava seems to be Ok.  However, gcc can still leak bogus unwind data via
_Unwind_GetRegionStart, so I'm proposing a patch like the following:

--- gcc-4.4.3/gcc/config/arm/unwind-arm.c.~1~
+++ gcc-4.4.3/gcc/config/arm/unwind-arm.c
@@ -621,7 +621,6 @@ get_eit_entry (_Unwind_Control_Block *uc
       UCB_PR_ADDR (ucbp) = 0;
       return _URC_FAILURE;
     }
-  ucbp->pr_cache.fnstart = selfrel_offset31 (&eitp->fnoffset);

   /* Can this frame be unwound at all?  */
   if (eitp->content == EXIDX_CANTUNWIND)
@@ -637,6 +636,15 @@ get_eit_entry (_Unwind_Control_Block *uc
       /* It is immediate data.  */
       ucbp->pr_cache.ehtp = (_Unwind_EHT_Header *)&eitp->content;
       ucbp->pr_cache.additional = 1;
+      /* Adjacent EIT entries with identical immediate data may be merged,
+        making fnoffset/fnstart inaccurate.  The ARM unwinder doesn't need
+        fnstart for immediate EIT data.  Other PRs than ARM's often use
+        fnstart to derive the locations of landing pads, but such PRs cannot
+        use immediate data in EIT entries, so are not affected by this issue.
+        However, code constructing stack traces may see stack frames for
+        functions with immediate data EIT entries.  Clear fnstart to ensure
+        _Unwind_GetRegionStart doesn't return wrong data in this case.  */
+      ucbp->pr_cache.fnstart = 0;
     }
   else
     {
@@ -645,6 +653,7 @@ get_eit_entry (_Unwind_Control_Block *uc
       ucbp->pr_cache.ehtp =
        (_Unwind_EHT_Header *) selfrel_offset31 (&eitp->content);
       ucbp->pr_cache.additional = 0;
+      ucbp->pr_cache.fnstart = selfrel_offset31 (&eitp->fnoffset);
     }

   /* Discover the personality routine address.  */

This caused no regressions for c/c++/objc/obj-c++, but libjava got two more
(ExtraClassLoader and InvokeInterface).

The problem with libjava appears to be its stacktrace.cc module. It uses
_Unwind_GetRegionStart to realign any interior PC to its function start PC,
then it uses that to look up method and class in a hash table keyed by method
start PC.  With the .ARM.exidx merging, _Unwind_GetRegionStart can return the
PC for a different method, possibly also in a different class, which totally
breaks this.  With my patch above libjava's stacktrace.cc can detect this case
and switch to a linear search instead.  I'll try to implement that soonish.


-- 


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


  parent reply	other threads:[~2010-03-30 13:21 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
2010-03-22 23:48 ` rearnsha at gcc dot gnu dot org
2010-03-30 13:21 ` mikpe at it dot uu dot se [this message]
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=20100330132111.20840.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).