From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20867 invoked by alias); 30 Mar 2010 13:21:13 -0000 Received: (qmail 20841 invoked by uid 48); 30 Mar 2010 13:21:11 -0000 Date: Tue, 30 Mar 2010 13:21:00 -0000 Message-ID: <20100330132111.20840.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libgcj/40860] [4.4/4.5 regression] regressions in libjava testsuite on arm-linux In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: java-prs@gcc.gnu.org From: "mikpe at it dot uu dot se" Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org X-SW-Source: 2010-q1/txt/msg00185.txt.bz2 ------- 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