This is the mail archive of the binutils@sources.redhat.com 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]

patch, xcoff linker pad section


This patch updates the reodering of pad sections in the aix linker wrt
the recent changes to how sections are created/ordered.

I will check this is soon.

Tom


--
Tom Rix
GCC Engineer
trix@redhat.com


2002-01-03  Tom Rix  <trix@redhat.com>

	* xcofflink.c (_bfd_xcoff_bfd_final_link): Update .pad section ordering
	for recent bfd_make_section_anyway change.
 
diff -rcp src-old/bfd/xcofflink.c src/bfd/xcofflink.c
*** src-old/bfd/xcofflink.c	Thu Jan  3 09:28:15 2002
--- src/bfd/xcofflink.c	Thu Jan  3 10:22:48 2002
*************** _bfd_xcoff_bfd_final_link (abfd, info)
*** 3656,3669 ****
  	{
  	  boolean saw_contents;
  	  int indx;
! 	  asection **op;
  	  file_ptr sofar;
! 
  	  /* Insert .pad sections before every section which has
               contents and is loaded, if it is preceded by some other
               section which has contents and is loaded.  */
  	  saw_contents = true;
! 	  for (op = &abfd->sections; *op != NULL; op = &(*op)->next)
  	    {
  	      if (strcmp ((*op)->name, ".pad") == 0)
  		saw_contents = false;
--- 3656,3670 ----
  	{
  	  boolean saw_contents;
  	  int indx;
! 	  asection **op, **prev;
  	  file_ptr sofar;
! 	  
  	  /* Insert .pad sections before every section which has
               contents and is loaded, if it is preceded by some other
               section which has contents and is loaded.  */
  	  saw_contents = true;
! 	  for (op = &abfd->sections, prev = NULL; 
! 	       *op != NULL; prev = op, op = &(*op)->next)
  	    {
  	      if (strcmp ((*op)->name, ".pad") == 0)
  		saw_contents = false;
*************** _bfd_xcoff_bfd_final_link (abfd, info)
*** 3674,3693 ****
  		    saw_contents = true;
  		  else
  		    {
! 		      asection *n, *hold;
! 
  		      hold = *op;
! 		      *op = NULL;
  		      n = bfd_make_section_anyway (abfd, ".pad");
- 		      BFD_ASSERT (*op == n);
- 		      n->next = hold;
  		      n->flags = SEC_HAS_CONTENTS;
! 		      n->alignment_power = 0;
  		      saw_contents = false;
  		    }
  		}
  	    }
! 
  	  /* Reset the section indices after inserting the new
               sections.  */
  	  indx = 0;
--- 3675,3713 ----
  		    saw_contents = true;
  		  else
  		    {
! 		      asection *n, *hold, **st;
! 		      
! 		      /* Create a pad section and place it before the section
! 			 that needs padding.  This requires unlinking and 
! 			 relinking the bfd's sections list. 
! 			 
! 			 sections = S1
! 			 .          S1.next = S2
! 			 .          S2.next = S3
! 			 .          S3.next = NULL
! 			 section_tail = &S3.next */
! 		      
  		      hold = *op;
! 		      st = abfd->section_tail;
! 		      
  		      n = bfd_make_section_anyway (abfd, ".pad");
  		      n->flags = SEC_HAS_CONTENTS;
! 		      n->alignment_power = 0; 
! 		      
! 		      if (NULL == prev) 
! 			abfd->sections = n;
! 		      else
! 			(*prev)->next = n;
! 		      
! 		      n->next = hold;
! 		      *st = NULL;
! 		      abfd->section_tail = st;
! 
  		      saw_contents = false;
  		    }
  		}
  	    }
! 	  
  	  /* Reset the section indices after inserting the new
               sections.  */
  	  indx = 0;
*************** _bfd_xcoff_bfd_final_link (abfd, info)
*** 3957,3973 ****
  	  || bfd_bwrite (finfo.outsyms, symesz, abfd) != symesz)
  	goto error_return;
      }
- 
-   /* init-fini */
-   if (info->init_function || info->fini_function)
-     {
-       struct xcoff_link_hash_entry *hrtinit;
- 
-       hrtinit = xcoff_link_hash_lookup (xcoff_hash_table (info),
- 					"__rtinit",
- 					false, false, true);
-     }
- 
  
    /* Write out all the global symbols which do not come from XCOFF
       input files.  */
--- 3977,3982 ----


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