This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [patch] Extend ARM .movsp for nested functions


> Approved with two provisos:
>
>    1. Fixing the spelling typo pointed out by Andreas.
>
>    2. Add a few extra lines to gas/testsuite/gas/arm/unwind.s to test the
>       new syntax (and obviously update the unwind*.d files as well).

Applied as attached.

Paul

2006-09-16  Paul Brook  <paul@codesourcery.com>

	gas/
	* config/tc-arm.c (s_arm_unwind_movsp): Add offset argument.
	* doc/c-arm.texi (movsp): Document offset argument.

	gas/testsuite/
	* gas/arm/unwind.s: Test two argument form of .movsp.
	* gas/arm/unwind.d: Update expected output.
	* gas/arm/unwind_vxworks.d: Ditto.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.292
diff -u -p -r1.292 tc-arm.c
--- gas/config/tc-arm.c	16 Sep 2006 00:55:33 -0000	1.292
+++ gas/config/tc-arm.c	16 Sep 2006 15:13:26 -0000
@@ -3628,6 +3628,7 @@ s_arm_unwind_movsp (int ignored ATTRIBUT
 {
   int reg;
   valueT op;
+  int offset;
 
   reg = arm_reg_parse (&input_line_pointer, REG_TYPE_RN);
   if (reg == FAIL)
@@ -3636,6 +3637,16 @@ s_arm_unwind_movsp (int ignored ATTRIBUT
       ignore_rest_of_line ();
       return;
     }
+
+  /* Optional constant.	 */
+  if (skip_past_comma (&input_line_pointer) != FAIL)
+    {
+      if (immediate_for_directive (&offset) == FAIL)
+	return;
+    }
+  else
+    offset = 0;
+
   demand_empty_rest_of_line ();
 
   if (reg == REG_SP || reg == REG_PC)
@@ -3653,7 +3664,7 @@ s_arm_unwind_movsp (int ignored ATTRIBUT
 
   /* Record the information for later.	*/
   unwind.fp_reg = reg;
-  unwind.fp_offset = unwind.frame_size;
+  unwind.fp_offset = unwind.frame_size - offset;
   unwind.sp_restored = 1;
 }
 
Index: gas/doc/c-arm.texi
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/doc/c-arm.texi,v
retrieving revision 1.40
diff -u -p -r1.40 c-arm.texi
--- gas/doc/c-arm.texi	24 Jul 2006 13:49:49 -0000	1.40
+++ gas/doc/c-arm.texi	16 Sep 2006 15:13:26 -0000
@@ -545,8 +545,10 @@ A positive value indicates the function 
 decrementing the stack pointer.
 
 @cindex @code{.movsp} directive, ARM
-@item .movsp @var{reg}
-Tell the unwinder that @var{reg} contains the current stack pointer.
+@item .movsp @var{reg} [, #@var{offset}]
+Tell the unwinder that @var{reg} contains an offset from the current
+stack pointer.  If @var{offset} is not specified then it is assumed to be
+zero.
 
 @cindex @code{.setfp} directive, ARM
 @item .setfp @var{fpreg}, @var{spreg} [, #@var{offset}]
Index: gas/testsuite/gas/arm/unwind.d
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/testsuite/gas/arm/unwind.d,v
retrieving revision 1.10
diff -u -p -r1.10 unwind.d
--- gas/testsuite/gas/arm/unwind.d	21 Aug 2006 11:41:24 -0000	1.10
+++ gas/testsuite/gas/arm/unwind.d	16 Sep 2006 16:04:28 -0000
@@ -25,18 +25,22 @@ OFFSET   TYPE              VALUE 
 0000001c R_ARM_PREL31      .ARM.extab.*
 00000020 R_ARM_PREL31      .text.*
 00000028 R_ARM_PREL31      .text.*
+00000030 R_ARM_PREL31      .text.*
+00000034 R_ARM_PREL31      .ARM.extab.*
 
 
 Contents of section .text:
  0000 (0000a0e3 0100a0e3 0200a0e3 0300a0e3|e3a00000 e3a00001 e3a00002 e3a00003)  .*
- 0010 (04200520|20052004)                             .*
+ 0010 (04200520 0600a0e3|20052004 e3a00006)                    .*
 Contents of section .ARM.extab:
  0000 (449b0181 b0b08086|81019b44 8680b0b0) 00000000 00000000  .*
  0010 (8402b101 b0b0b005 2a000000 00c60281|01b10284 05b0b0b0 0000002a 8102c600)  .*
- 0020 (d0c6c1c1 b0b0c0c6|c1c1c6d0 c6c0b0b0) 00000000           .*
+ 0020 (d0c6c1c1 b0b0c0c6|c1c1c6d0 c6c0b0b0) 00000000 (429b0181|81019b42)  .*
+ 0030 (b0008086|868000b0) 00000000                    .*
 Contents of section .ARM.exidx:
  0000 00000000 (b0b0a880 04000000|80a8b0b0 00000004) 00000000  .*
  0010 (08000000 0c000000 0c000000 1c000000|00000008 0000000c 0000000c 0000001c)  .*
  0020 (10000000 08849780 12000000 b00fb180|00000010 80978408 00000012 80b10fb0)  .*
+ 0030 (14000000 2c000000|00000014 0000002c)                    .*
 # Ignore .ARM.attributes section
 #...
Index: gas/testsuite/gas/arm/unwind.s
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/testsuite/gas/arm/unwind.s,v
retrieving revision 1.3
diff -u -p -r1.3 unwind.s
--- gas/testsuite/gas/arm/unwind.s	21 Aug 2006 11:41:24 -0000	1.3
+++ gas/testsuite/gas/arm/unwind.s	16 Sep 2006 16:06:56 -0000
@@ -51,3 +51,17 @@ foo5:	@ Save r0-r3 only.
 	.save {r0, r1, r2, r3}
 	mov r0, #5
 	.fnend
+	.code 32
+foo6:	@ Nested function with frame pointer
+	.fnstart
+	.pad #4
+	@push {ip}
+	.movsp ip, #4
+	@mov ip, sp
+	.pad #4
+	.save {fp, ip, lr}
+	@stmfd sp!, {fp, ip, lr, pc}
+	.setfp fp, ip, #-8
+	@sub fp, ip, #8
+	mov r0, #6
+	.fnend
Index: gas/testsuite/gas/arm/unwind_vxworks.d
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/testsuite/gas/arm/unwind_vxworks.d,v
retrieving revision 1.4
diff -u -p -r1.4 unwind_vxworks.d
--- gas/testsuite/gas/arm/unwind_vxworks.d	21 Aug 2006 11:41:24 -0000	1.4
+++ gas/testsuite/gas/arm/unwind_vxworks.d	16 Sep 2006 16:13:33 -0000
@@ -24,6 +24,8 @@ OFFSET   TYPE              VALUE 
 0000001c R_ARM_PREL31      .ARM.extab.*\+0x0000001c
 00000020 R_ARM_PREL31      .text.*\+0x00000010
 00000028 R_ARM_PREL31      .text.*\+0x00000012
+00000030 R_ARM_PREL31      .text.*\+0x00000014
+00000034 R_ARM_PREL31      .ARM.extab.*\+0x0000002c
 
 
 Contents of section .text:
@@ -32,10 +34,12 @@ Contents of section .text:
 Contents of section .ARM.extab:
  0000 (449b0181 b0b08086|81019b44 8680b0b0) 00000000 00000000  .*
  0010 (8402b101 b0b0b005 2a000000 00c60281|01b10284 05b0b0b0 0000002a 8102c600)  .*
- 0020 (d0c6c1c1 b0b0c0c6|c1c1c6d0 c6c0b0b0) 00000000           .*
+ 0020 (d0c6c1c1 b0b0c0c6|c1c1c6d0 c6c0b0b0) 00000000 (429b0181|81019b42)  .*
+ 0030 (b0008086|868000b0) 00000000                    .*
 Contents of section .ARM.exidx:
  0000 00000000 (b0b0a880|80a8b0b0) 00000000 00000000  .*
  0010 00000000 00000000 00000000 00000000  .*
  0020 00000000 (08849780|80978408) 00000000 (b00fb180|80b10fb0)  .*
+ 0030 00000000 00000000                    .*
 # Ignore .ARM.attributes section
 #...

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