This is the mail archive of the
mailing list for the GCC project.
Re: Add unwind information for ARM div0 and interworking stubs
- From: Daniel Jacobowitz <drow at false dot org>
- To: gcc-patches at gcc dot gnu dot org, Richard Earnshaw <Richard dot Earnshaw at arm dot com>,Paul Brook <paul at codesourcery dot com>
- Date: Tue, 17 May 2005 08:51:02 -0400
- Subject: Re: Add unwind information for ARM div0 and interworking stubs
- References: <20050513213402.GA23547@nevyn.them.org>
On Fri, May 13, 2005 at 05:34:02PM -0400, Daniel Jacobowitz wrote:
> This patch got a little larger than I expected...
> The original problem I wanted to solve was that when you divide by zero on
> arm-linux, GDB can not backtrace from the point where the signal is raised.
> This is because of the stack frame created at the end of __divsi3; the
> function is otherwise frameless, so GDB assumes that lr is not on the stack.
> The only way to fix this is to provide an appropriate .debug_frame.
> The gas cfi directives are not useful for this. They create a .eh_frame
> section, instead of a .debug_frame section; we don't need the extra bytes
> in an allocated section on ARM. It would be nice if gas supported geerating
> .debug_frame instead of .eh_frame at some point.
> While I was there, I noticed a couple minor problems in this file:
> - The interworking stubs and division routines call out with a
> non-doubleword-aligned stack.
> - The GNU/Linux div0 handler raises a signal by sys_kill, but if
> sys_tkill is available, we should use that. Otherwise a random
> thread is going to receive the signal (in NPTL). Ditto gettid
> versus getpid.
> Tested on arm-elf simulator, and by hand on arm-linux and arm-elf. I
> checked backtraces from div0 on arm-elf ARM, arm-elf Thumb, and arm-linux.
> I checked backtraces through _arm_return using -mcaller-super-interworking.
> I checked behavior of the tkill changes when gettid or tkill returns ENOSYS.
> Is this OK?
> 2005-05-13 Daniel Jacobowitz <email@example.com>
> * config/arm/lib1funcs.asm (cfi_pop, cfi_push, cfi_start)
> (cfi_end): New macros.
> (RETLDM): Use cfi_pop. Expect an eight byte stack frame.
> (ARM_LDIV0, THUMB_LDIV0, DIV_FUNC_END): Use CFI macros. Create
> an eight byte stack frame.
> (__NR_tkill): Define.
> (__div0): Use gettid tkill on GNU/Linux.
> (_arm_return): Add CFI.
> (Lchange_\register, .Lchange_lr): Create an eight byte stack frame.