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, AIX stripping native


gnu strip fails on stripping native apps.  When a native app is tripped
the AIX loader checks the text alignment and fails.   The alignment is
not the alignment stated in xcoff spec but the difference between the
text section file position and the text section vma.   Yes that's icky.

I am sure this patch works for AIX and don't think (by inspection) that
it will affect other targets.

If there are no comments, I will check this in shortly.

--
Tom Rix
GCC Engineer
trix@redhat.com


2001-12-19  Tom Rix  <trix@bluey.cygnus.com>
 
 	* coffcode.h (coff_compute_section_file_positions): Add special AIX 
 	loader aligment of text section.
 
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.65
diff -c -p -r1.65 coffcode.h
*** coffcode.h	2001/12/18 00:32:32	1.65
--- coffcode.h	2001/12/20 00:14:24
*************** coff_compute_section_file_positions (abf
*** 3054,3060 ****
  	     padding the previous section up if necessary */
  
  	  old_sofar = sofar;
! 	  sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
  	  if (previous != (asection *) NULL)
  	    {
  	      previous->_raw_size += sofar - old_sofar;
--- 3054,3089 ----
  	     padding the previous section up if necessary */
  
  	  old_sofar = sofar;
! #ifdef RS6000COFF_C
! 	  /* AIX loader checks the text section alignment of (vma - filepos)
! 	     So even though the filepos may be aligned wrt the o_algntext, for
! 	     AIX executables, this check fails. This shows up when an native 
! 	     AIX executable is stripped with gnu strip because the default vma
! 	     of native is 0x10000150 but default for gnu is 0x10000140.  Gnu
! 	     stripped gnu excutable passes this check because the filepos is 
! 	     0x0140. */
! 	  if (!strcmp (current->name, _TEXT)) 
! 	    {
! 	      bfd_vma pad;
! 	      bfd_vma align;
! 
! 	      sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
! 
! 	      align = 1 << current->alignment_power;
! 	      pad = abs (current->vma - sofar) % align;
! 	      
! 	      if (pad) 
! 		{
! 		  pad = align - pad;
! 		  sofar += pad;
! 		}
! 	    }
! 	  else
! #else
! 	    {
! 	      sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);
! 	    }
! #endif
  	  if (previous != (asection *) NULL)
  	    {
  	      previous->_raw_size += sofar - old_sofar;

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