[backport proposed but not yet approved or applied patch for 4.8/trunk <mikpe@it.uu.se>]

From: Meador Inge <meadori at codesourcery dot com>
Subject: [PATCH] libgcc: Add DWARF info to aeabi_ldivmod and aeabi_uldivmod
Date: Tue, 5 Mar 2013 12:15:04 -0600
List-Archive: <http://gcc.gnu.org/ml/gcc-patches/>

Hi All,

This patch fixes a minor annoyance that causes backtraces to disappear
inside of aeabi_ldivmod and aeabi_uldivmod due to the lack of appropriate
DWARF information.  I fixed the problem by adding the necessary cfi_*
macros in these functions.

OK?

2013-03-05  Meador Inge  <meadori@codesourcery.com>

	* config/arm/bpabi.S (aeabi_ldivmod): Add DWARF information for
	computing the location of the link register.
	(aeabi_uldivmod): Ditto.

--- gcc-4.6.3/gcc/config/arm/bpabi.S.~1~	2011-01-03 21:52:22.000000000 +0100
+++ gcc-4.6.3/gcc/config/arm/bpabi.S	2013-03-09 13:21:04.924194843 +0100
@@ -124,6 +124,7 @@ ARM_FUNC_START aeabi_ulcmp
 #ifdef L_aeabi_ldivmod
 
 ARM_FUNC_START aeabi_ldivmod
+	cfi_start	__aeabi_ldivmod, LSYM(Lend_aeabi_ldivmod)
 	test_div_by_zero signed
 
 	sub sp, sp, #8
@@ -133,17 +134,20 @@ ARM_FUNC_START aeabi_ldivmod
 #else
 	do_push {sp, lr}
 #endif
+98:	cfi_push 98b - __aeabi_ldivmod, 0xe, -0xc, 0x10
 	bl SYM(__gnu_ldivmod_helper) __PLT__
 	ldr lr, [sp, #4]
 	add sp, sp, #8
 	do_pop {r2, r3}
 	RET
+	cfi_end	LSYM(Lend_aeabi_ldivmod)
 	
 #endif /* L_aeabi_ldivmod */
 
 #ifdef L_aeabi_uldivmod
 
 ARM_FUNC_START aeabi_uldivmod
+	cfi_start	__aeabi_uldivmod, LSYM(Lend_aeabi_uldivmod)
 	test_div_by_zero unsigned
 
 	sub sp, sp, #8
@@ -153,11 +157,13 @@ ARM_FUNC_START aeabi_uldivmod
 #else
 	do_push {sp, lr}
 #endif
+98:	cfi_push 98b - __aeabi_uldivmod, 0xe, -0xc, 0x10
 	bl SYM(__gnu_uldivmod_helper) __PLT__
 	ldr lr, [sp, #4]
 	add sp, sp, #8
 	do_pop {r2, r3}
 	RET
-	
+	cfi_end	LSYM(Lend_aeabi_uldivmod)
+
 #endif /* L_aeabi_divmod */
 	
