This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add unwind information for ARM div0 and interworking stubs


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  <>
> 	* 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.

Daniel Jacobowitz
CodeSourcery, LLC

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]