Fixup references to bfd_section_list... macros

Nick Clifton nickc@redhat.com
Tue May 3 12:11:00 GMT 2005


Hi Guys,

  H.J.'s recent patch to update the bfd_section_list manipulation
  macros fixed a few small cases in the gas directory.  So I am going
  to apply the patch below to fix them.

Cheers
  Nick

gas/ChangeLog
2005-05-03  Nick Clifton  <nickc@redhat.com>

	* config/obj-ecoff.c (ecoff_frob_file_before_fix): Fix invocations
	of bfd_section_list... macros.
	* config/tc-mmix.c (mmix_frob_file): Likewise.
	* config/tc-xtensa.c (xtensa_remove_section): Likewise.
	(xtensa_insert_section): Likewise.

Index: gas/config/obj-ecoff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-ecoff.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 obj-ecoff.c
*** gas/config/obj-ecoff.c	24 Mar 2005 20:40:25 -0000	1.13
--- gas/config/obj-ecoff.c	3 May 2005 11:55:43 -0000
*************** ecoff_frob_file_before_fix (void)
*** 78,84 ****
  
    addr = 0;
    for (i = 0; i < n_names; i++)
!     secs[i] = 0;
  
    for (sec = &stdoutput->sections; *sec !=  NULL;)
      {
--- 78,84 ----
  
    addr = 0;
    for (i = 0; i < n_names; i++)
!     secs[i] = NULL;
  
    for (sec = &stdoutput->sections; *sec !=  NULL;)
      {
*************** ecoff_frob_file_before_fix (void)
*** 86,92 ****
  	if (!strcmp ((*sec)->name, names[i]))
  	  {
  	    secs[i] = *sec;
! 	    bfd_section_list_remove (stdoutput, sec);
  	    break;
  	  }
        if (i == n_names)
--- 86,92 ----
  	if (!strcmp ((*sec)->name, names[i]))
  	  {
  	    secs[i] = *sec;
! 	    bfd_section_list_remove (stdoutput, *sec);
  	    break;
  	  }
        if (i == n_names)
*************** ecoff_frob_file_before_fix (void)
*** 104,110 ****
        }
    for (i = n_names - 1; i >= 0; i--)
      if (secs[i])
!       bfd_section_list_insert (stdoutput, &stdoutput->sections, secs[i]);
  
    /* Fill in the register masks.  */
    {
--- 104,110 ----
        }
    for (i = n_names - 1; i >= 0; i--)
      if (secs[i])
!       bfd_section_list_insert_after (stdoutput, stdoutput->sections, secs[i]);
  
    /* Fill in the register masks.  */
    {
Index: gas/config/tc-mmix.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mmix.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 tc-mmix.c
*** gas/config/tc-mmix.c	20 Apr 2005 17:40:01 -0000	1.20
--- gas/config/tc-mmix.c	3 May 2005 11:55:44 -0000
*************** mmix_frob_file (void)
*** 3747,3764 ****
  
    if (real_reg_section != NULL)
      {
!       asection **secpp;
  
        /* FIXME: Pass error state gracefully.  */
        if (bfd_get_section_flags (stdoutput, real_reg_section) & SEC_HAS_CONTENTS)
  	as_fatal (_("register section has contents\n"));
  
        /* Really remove the section.  */
!       for (secpp = &stdoutput->sections;
! 	   *secpp != real_reg_section;
! 	   secpp = &(*secpp)->next)
  	;
!       bfd_section_list_remove (stdoutput, secpp);
        --stdoutput->section_count;
      }
  
--- 3747,3764 ----
  
    if (real_reg_section != NULL)
      {
!       asection *secp;
  
        /* FIXME: Pass error state gracefully.  */
        if (bfd_get_section_flags (stdoutput, real_reg_section) & SEC_HAS_CONTENTS)
  	as_fatal (_("register section has contents\n"));
  
        /* Really remove the section.  */
!       for (secp = stdoutput->sections;
! 	   secp != real_reg_section;
! 	   secp = secp->next)
  	;
!       bfd_section_list_remove (stdoutput, secp);
        --stdoutput->section_count;
      }
  
Index: gas/config/tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 tc-xtensa.c
*** gas/config/tc-xtensa.c	22 Apr 2005 21:37:31 -0000	1.36
--- gas/config/tc-xtensa.c	3 May 2005 11:55:48 -0000
*************** xtensa_remove_section (segT sec)
*** 9690,9701 ****
    /* Handle brain-dead bfd_section_list_remove macro, which
       expect the address of the prior section's "next" field, not
       just the address of the section to remove.  */
  
!   segT *ps_next_ptr = &stdoutput->sections;
!   while (*ps_next_ptr != sec && *ps_next_ptr != NULL) 
!     ps_next_ptr = &(*ps_next_ptr)->next;
    
!   assert (*ps_next_ptr != NULL);
  
    bfd_section_list_remove (stdoutput, ps_next_ptr);
  }
--- 9690,9701 ----
    /* Handle brain-dead bfd_section_list_remove macro, which
       expect the address of the prior section's "next" field, not
       just the address of the section to remove.  */
+   segT ps_next_ptr = stdoutput->sections;
  
!   while (ps_next_ptr != sec && ps_next_ptr != NULL) 
!     ps_next_ptr = ps_next_ptr->next;
    
!   assert (ps_next_ptr != NULL);
  
    bfd_section_list_remove (stdoutput, ps_next_ptr);
  }
*************** xtensa_remove_section (segT sec)
*** 9704,9716 ****
  static void
  xtensa_insert_section (segT after_sec, segT sec)
  {
!   segT *after_sec_next;
    if (after_sec == NULL)
!     after_sec_next = &stdoutput->sections;
    else
!     after_sec_next = &after_sec->next;
  
!   bfd_section_list_insert (stdoutput, after_sec_next, sec);
  }
  
  
--- 9704,9717 ----
  static void
  xtensa_insert_section (segT after_sec, segT sec)
  {
!   segT after_sec_next;
! 
    if (after_sec == NULL)
!     after_sec_next = stdoutput->sections;
    else
!     after_sec_next = after_sec->next;
  
!   bfd_section_list_insert_after (stdoutput, after_sec_next, sec);
  }
  
  
  



More information about the Binutils mailing list