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: Update ARM mapping symbol support


On Sun, Aug 02, 2009 at 08:13:51PM +0100, Richard Earnshaw wrote:
> 	.code	16
> 	.type	_obstack_newchunk, %function
> _obstack_newchunk:
> 	push	{r4, r5, r6, r7, lr}
> 	.ident	"GCC: (GNU) 4.5.0 20090801 (experimental)"
> 	.code 16
> 	.align	1
> .L13:
> 	bx	r2
> 
> $ as-new test.s 
> test.s: Assembler messages:
> test.s:9: Internal error!
> Assertion failure in make_mapping_symbol
> at /home/rearnsha/gnusrc/gcc-cross/trunk/gas/config/tc-arm.c line 2491.
> Please report this bug.

Thanks for the test case.  Even with my fix to obj_elf_ident,
md_elf_section_change_hook is not called reliably; the map state still
lines up with .comment even though we're back in .text after the end
of .ident.

It'd be easy to bandaid this particular case, but to track global
state using the section change hook we'd have to audit at least all
the calls to subseg_new (I got most of these last time) and
subseg_set.

This is all a bit silly; much easier to remove the global variables.
We have to update the global copies anyway.  I've tested this
on arm-none-eabi and checked it in.  It also fixes a bug that caused
$d to appear in *ABS* in the same testcase; we were generating
a mapping symbol for expr_section.

-- 
Daniel Jacobowitz
CodeSourcery

2009-08-07  Daniel Jacobowitz  <dan@codesourcery.com>

	* config/tc-arm.c (marked_pr_dependency, mapstate): Delete global
	variables.
	(mapping_state): Use the section's mapstate.
	(mapping_state_2): Likewise.  Skip special sections.
	(s_arm_unwind_fnend): Use the section's marked_pr_dependency.
	(arm_elf_change_section): Do not set deleted globals.
	* config/tc-arm.h (struct arm_segment_info_type): Document
	marked_pr_dependency.

2009-08-07  Daniel Jacobowitz  <dan@codesourcery.com>

	* gas/arm/mapping2.s: Test code after .ident.

Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.400
diff -u -p -r1.400 tc-arm.c
--- gas/config/tc-arm.c	6 Aug 2009 10:10:50 -0000	1.400
+++ gas/config/tc-arm.c	7 Aug 2009 19:21:08 -0000
@@ -77,11 +77,6 @@ static struct
   unsigned	  sp_restored:1;
 } unwind;
 
-/* Bit N indicates that an R_ARM_NONE relocation has been output for
-   __aeabi_unwind_cpp_prN already if set. This enables dependencies to be
-   emitted only once per section, to save unnecessary bloat.  */
-static unsigned int marked_pr_dependency = 0;
-
 #endif /* OBJ_ELF */
 
 /* Results from operand parsing worker functions.  */
@@ -2432,8 +2427,6 @@ s_unreq (int a ATTRIBUTE_UNUSED)
    Note that previously, $a and $t has type STT_FUNC (BSF_OBJECT flag),
    and $d has type STT_OBJECT (BSF_OBJECT flag). Now all three are untyped.  */
 
-static enum mstate mapstate = MAP_UNDEFINED;
-
 /* Create a new mapping symbol for the transition to STATE.  */
 
 static void
@@ -2532,6 +2525,8 @@ static void mapping_state_2 (enum mstate
 void
 mapping_state (enum mstate state)
 {
+  enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate;
+
 #define TRANSITION(from, to) (mapstate == (from) && state == (to))
 
   if (mapstate == state)
@@ -2565,12 +2560,16 @@ mapping_state (enum mstate state)
 static void
 mapping_state_2 (enum mstate state, int max_chars)
 {
+  enum mstate mapstate = seg_info (now_seg)->tc_segment_info_data.mapstate;
+
+  if (!SEG_NORMAL (now_seg))
+    return;
+
   if (mapstate == state)
     /* The mapping symbol has already been emitted.
        There is nothing else to do.  */
     return;
 
-  mapstate = state;
   seg_info (now_seg)->tc_segment_info_data.mapstate = state;
   make_mapping_symbol (state, (valueT) frag_now_fix () - max_chars, frag_now);
 }
@@ -3421,6 +3420,7 @@ s_arm_unwind_fnend (int ignored ATTRIBUT
   long where;
   char *ptr;
   valueT val;
+  unsigned int marked_pr_dependency;
 
   demand_empty_rest_of_line ();
 
@@ -3450,6 +3450,8 @@ s_arm_unwind_fnend (int ignored ATTRIBUT
 
   /* Indicate dependency on EHABI-defined personality routines to the
      linker, if it hasn't been done already.  */
+  marked_pr_dependency
+    = seg_info (now_seg)->tc_segment_info_data.marked_pr_dependency;
   if (unwind.personality_index >= 0 && unwind.personality_index < 3
       && !(marked_pr_dependency & (1 << unwind.personality_index)))
     {
@@ -3461,9 +3463,8 @@ s_arm_unwind_fnend (int ignored ATTRIBUT
 	};
       symbolS *pr = symbol_find_or_make (name[unwind.personality_index]);
       fix_new (frag_now, where, 0, pr, 0, 1, BFD_RELOC_NONE);
-      marked_pr_dependency |= 1 << unwind.personality_index;
       seg_info (now_seg)->tc_segment_info_data.marked_pr_dependency
-	= marked_pr_dependency;
+	|= 1 << unwind.personality_index;
     }
 
   if (val)
@@ -18557,19 +18558,10 @@ arm_init_frag (fragS * fragP, int max_ch
 void
 arm_elf_change_section (void)
 {
-  segment_info_type *seginfo;
-
   /* Link an unlinked unwind index table section to the .text section.	*/
   if (elf_section_type (now_seg) == SHT_ARM_EXIDX
       && elf_linked_to_section (now_seg) == NULL)
     elf_linked_to_section (now_seg) = text_section;
-
-  if (!SEG_NORMAL (now_seg))
-    return;
-
-  seginfo = seg_info (now_seg);
-  marked_pr_dependency = seginfo->tc_segment_info_data.marked_pr_dependency;
-  mapstate = seginfo->tc_segment_info_data.mapstate;
 }
 
 int
Index: gas/config/tc-arm.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.h,v
retrieving revision 1.54
diff -u -p -r1.54 tc-arm.h
--- gas/config/tc-arm.h	31 Jul 2009 18:14:07 -0000	1.54
+++ gas/config/tc-arm.h	7 Aug 2009 19:21:08 -0000
@@ -272,7 +272,12 @@ void mapping_state (enum mstate);
 struct arm_segment_info_type
 {
   enum mstate mapstate;
+
+  /* Bit N indicates that an R_ARM_NONE relocation has been output for
+     __aeabi_unwind_cpp_prN already if set. This enables dependencies to be
+     emitted only once per section, to save unnecessary bloat.  */
   unsigned int marked_pr_dependency;
+
   struct current_it current_it;
 };
 
Index: gas/testsuite/gas/arm/mapping2.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/mapping2.s,v
retrieving revision 1.1
diff -u -p -r1.1 mapping2.s
--- gas/testsuite/gas/arm/mapping2.s	31 Jul 2009 18:14:07 -0000	1.1
+++ gas/testsuite/gas/arm/mapping2.s	7 Aug 2009 19:21:08 -0000
@@ -17,3 +17,4 @@ foo:
         .size   main, .-main
         .ident  ""
 
+	nop


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