ARM mapping symbols

Bruno De Bus bdebus@elis.ugent.be
Tue Mar 9 11:01:00 GMT 2004


On Tue, 9 Mar 2004, Richard Earnshaw wrote:

> > On Mon, 8 Mar 2004, Richard Earnshaw wrote:
> This is a *vast* improvement.  There's a couple of minor technical 
> niggles, where you haven't conformed to the GNU coding standards, and 
> there's no ChangeLog entry.  But other than that, I think this is OK now.
> 
> It would also be good if there were test cases added to the regression 
> suite to check ensure that we don't break things again in future.
> 
> > Bruno
> > 
> > PS:
> > 
> > I applied for a copyright assignment (but the patch is really small, even 
> > smaller than the first one)
> 
> This is Nick's call.  I'd err on the side of caution and ask for one, but 
> as lead maintainer, Nick might be prepared to let this one through.

If I receive the papers I will sign them.
 
> Please can you fix up the niggles, add a ChangeLog entry and re-send the 
> diff using "diff -p" format.

done...

And I incorporated your remarks... Thanks for that...

Bruno

> General: in all cases there should be a space between the function name 
> and the opening parenthesis for the arguments/parameters.
> 
> 	foo ()
> never
> 	foo()
> 
> 
> >  
> > -static void
> > -mapping_state (enum mstate state)
> > +static enum mstate mapstate = MAP_UNDEFINED;
> > +
> > +static void mapping_state (enum mstate state)
> 
> Function name on a new line.
> 
> >  {
> > -  static enum mstate mapstate = MAP_DATA;
> >    symbolS * symbolP;
> >    const char * symname;
> >    int type;
> > @@ -2933,10 +2926,15 @@
> >        symname = "$t";
> >        type = BSF_FUNCTION;
> >        break;
> > +    case MAP_UNDEFINED:
> > +      return;
> > +      
> 
> blank line before new case statement.
> 
> > @@ -3111,6 +3100,9 @@
> >  
> >    /* Align pool as you have word accesses.
> >       Only make a frag if we have to.  */
> > +
> > +
> > +  mapping_state(MAP_DATA);
> 
> excess blank lines between comment and code.  In fact, this comment is now 
> divorced from the code it refers to.  Please rearrange that.
> 
> >    if (!need_pass_2)
> >      frag_align (2, 0, 0);
> >  
> > +enum mstate
> > +{
> > +  MAP_UNDEFINED=0, /* Must be zero, for seginfo in new sections */
> 
> White space around '='
> 
> R.
> 
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.2071
diff -p -r1.2071 ChangeLog
*** ChangeLog	7 Mar 2004 15:00:15 -0000	1.2071
--- ChangeLog	9 Mar 2004 10:59:13 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2004-03-09  Bruno De Bus <bdebus@elis.ugent.be>
+ 
+ 	* config/tc-arm.c (mapping_state, s_ltorg, arm_cleanup): 
+ 	Fixed arm mapping symbols
+ 	* config/tc-arm.h: moved the definition for the arm mapping 
+ 	states here and added the state to each section
+ 
  2004-03-07  Andreas Schwab  <schwab@suse.de>
  
  	* doc/c-hppa.texi (HPPA Directives): Fix typo.
Index: config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.163
diff -p -r1.163 tc-arm.c
*** config/tc-arm.c	18 Feb 2004 16:28:17 -0000	1.163
--- config/tc-arm.c	9 Mar 2004 10:59:14 -0000
*************** validate_offset_imm (val, hwse)
*** 2823,2835 ****
  
  
  #ifdef OBJ_ELF
- enum mstate
- {
-   MAP_DATA,
-   MAP_ARM,
-   MAP_THUMB
- };
- 
  /* This code is to handle mapping symbols as defined in the ARM ELF spec.
     (This text is taken from version B-02 of the spec):
  
--- 2823,2828 ----
*************** enum mstate
*** 2904,2913 ****
     the EABI (which is still under development), so they are not
     implemented here.  */
  
! static void
  mapping_state (enum mstate state)
  {
-   static enum mstate mapstate = MAP_DATA;
    symbolS * symbolP;
    const char * symname;
    int type;
--- 2897,2907 ----
     the EABI (which is still under development), so they are not
     implemented here.  */
  
! static enum mstate mapstate = MAP_UNDEFINED;
! 
! static void 
  mapping_state (enum mstate state)
  {
    symbolS * symbolP;
    const char * symname;
    int type;
*************** mapping_state (enum mstate state)
*** 2925,2942 ****
--- 2919,2944 ----
        symname = "$d";
        type = BSF_OBJECT;
        break;
+       
      case MAP_ARM:
        symname = "$a";
        type = BSF_FUNCTION;
        break;
+       
      case MAP_THUMB:
        symname = "$t";
        type = BSF_FUNCTION;
        break;
+       
+     case MAP_UNDEFINED:
+       return;
+       
      default:
        abort ();
      }
  
+   seg_info (now_seg)->tc_segment_info_data=state;
+ 
    symbolP = symbol_new (symname, now_seg, (valueT) frag_now_fix (), frag_now);
    symbol_table_insert (symbolP);
    symbol_get_bfdsym (symbolP)->flags |= type | BSF_LOCAL;
*************** arm_elf_change_section (void)
*** 2977,2992 ****
    if ((flags & SEC_ALLOC) == 0)
      return;
  
!   if (flags & SEC_CODE)
!     {
!       if (thumb_mode)
! 	mapping_state (MAP_THUMB);
!       else
! 	mapping_state (MAP_ARM);
!     }
!   else
!     /* This section does not contain code.  Therefore it must contain data.  */
!     mapping_state (MAP_DATA);    
  }
  #else
  #define mapping_state(a)
--- 2979,2985 ----
    if ((flags & SEC_ALLOC) == 0)
      return;
  
!   mapstate=seg_info (now_seg)->tc_segment_info_data;
  }
  #else
  #define mapping_state(a)
*************** s_ltorg (ignored)
*** 3108,3113 ****
--- 3101,3108 ----
        || pool->symbol == NULL
        || pool->next_free_entry == 0)
      return;
+   
+   mapping_state (MAP_DATA);
  
    /* Align pool as you have word accesses.
       Only make a frag if we have to.  */
*************** s_force_thumb (ignore)
*** 3184,3189 ****
--- 3179,3185 ----
       This is used by gcc/config/arm/lib1funcs.asm for example
       to compile interworking support functions even if the
       target processor should not support interworking.  */
+ 
    if (! thumb_mode)
      {
        thumb_mode = 2;
*************** arm_cleanup ()
*** 13817,13822 ****
--- 13813,13821 ----
      {
        /* Put it at the end of the relevent section.  */
        subseg_set (pool->section, pool->sub_section);
+ #ifdef OBJ_ELF
+       arm_elf_change_section ();
+ #endif
        s_ltorg (0);
      }
  }
Index: config/tc-arm.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.h,v
retrieving revision 1.21
diff -p -r1.21 tc-arm.h
*** config/tc-arm.h	21 Nov 2003 00:24:40 -0000	1.21
--- config/tc-arm.h	9 Mar 2004 10:59:14 -0000
*************** struct fix;
*** 91,99 ****
  # define TARGET_FORMAT elf32_arm_target_format()
    extern const char * elf32_arm_target_format PARAMS ((void));
  
! # define md_elf_section_change_hook() arm_elf_change_section
    extern void arm_elf_change_section (void);
  #endif
  
  #define TC_FORCE_RELOCATION(FIX) arm_force_relocation (FIX)
  extern int arm_force_relocation PARAMS ((struct fix *));
--- 91,111 ----
  # define TARGET_FORMAT elf32_arm_target_format()
    extern const char * elf32_arm_target_format PARAMS ((void));
  
! # define md_elf_section_change_hook() arm_elf_change_section()
    extern void arm_elf_change_section (void);
+ 
+ enum mstate
+ {
+   MAP_UNDEFINED = 0, /* Must be zero, for seginfo in new sections */
+   MAP_DATA,
+   MAP_ARM,
+   MAP_THUMB
+ };
+ 
+ 
+ #define TC_SEGMENT_INFO_TYPE enum mstate
  #endif
+ 
  
  #define TC_FORCE_RELOCATION(FIX) arm_force_relocation (FIX)
  extern int arm_force_relocation PARAMS ((struct fix *));


More information about the Binutils mailing list