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]

[csl-arm] Fix unwinding corner case.

It's possible for the last instruction in a function to be a call to a 
function that throws an exception. This typically happens for noreturn 

In this case the return address (used while unwinding) will point to the start 
of the next function.

The attached patch fixes this by adjusting the address backwards by two bytes 
before doing the lookup. This should place it inside the call instruction for 
both arm and thumb modes.

Tested with cross to arm-none-eabi.
Applied to csl-arm-branch.


2005-05-06  Paul Brook  <>

	* config/arm/unwind-arm.c (get_eit_entry): Adjust address to throwing
	call, not following instruction.
Index: config/arm/unwind-arm.c
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/config/arm/Attic/unwind-arm.c,v
retrieving revision
diff -u -p -r1.1.2.8 unwind-arm.c
--- config/arm/unwind-arm.c	16 Feb 2005 01:46:04 -0000
+++ config/arm/unwind-arm.c	6 May 2005 17:05:44 -0000
@@ -380,6 +380,13 @@ get_eit_entry (_Unwind_Control_Block *uc
   const __EIT_entry * eitp;
   int nrec;
+  /* The return address is the address of the instruction following the
+     call instruction (plus one in thumb mode).  If this was the last
+     instruction in the function the address will lie in the following
+     function.  Subtract 2 from the address so that it points within the call
+     instruction itself.  */
+  return_address -= 2;
   if (__gnu_Unwind_Find_exidx)
       eitp = (const __EIT_entry *) __gnu_Unwind_Find_exidx (return_address,

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