This is the mail archive of the binutils@sourceware.cygnus.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]

Fix for alignment of .stab section in sh-pe gas


Hi Joern,

  I recently discovered a problem with the sh-pe toolchain.  It would
  generate .stab and .stabstr sections with 16 byte alignment, which
  is a bad thing since individual stabs are only 12 bytes long and the
  strings can be of any length at all.  The patch below fixes this by
  restoring the proper alignments of 4 bytes and 1 byte respectively
  to these two sections.  (It also sets the alignment of the .ctors
  and .dtors sections to 4 bytes as well, which I assume is correct,
  although I do not know this for sure).

  May I apply this patch ?

Cheers
	Nick


2000-03-28  Nick Clifton  <nickc@cygnus.com>

	* config/tc-sh.h (SUB_SEGMENT_ALIGN): Give the .stab section an
	alignment of 2 and the .stabstr section an alignment of 0.

	* config/tc-sh.c (sh_cons_align): Do not generate alignment
	frags in the .stab section.
	
Index: config/tc-sh.c
===================================================================
RCS file: /cvs/src//src/gas/config/tc-sh.c,v
retrieving revision 1.11
diff -p -r1.11 tc-sh.c
*** tc-sh.c	2000/03/27 16:17:08	1.11
--- tc-sh.c	2000/03/29 02:14:54
*************** sh_cons_align (nbytes)
*** 2328,2333 ****
--- 2328,2336 ----
        return;
      }
  
+   if (strcmp (segment_name (now_seg), ".stab") == 0)
+     return;
+   
    nalign = 0;
    while ((nbytes & 1) == 0)
      {

Index: config/tc-sh.h
===================================================================
RCS file: /cvs/src//src/gas/config/tc-sh.h,v
retrieving revision 1.4
diff -p -r1.4 tc-sh.h
*** tc-sh.h	2000/02/24 19:46:28	1.4
--- tc-sh.h	2000/03/29 02:14:54
*************** extern void sh_coff_reloc_mangle
*** 130,136 ****
  extern int tc_coff_sizemachdep PARAMS ((fragS *));
  
  #ifdef BFD_ASSEMBLER
! #define SUB_SEGMENT_ALIGN(SEG) 4
  #else
  /* We align most sections to a 16 byte boundary.  */
  #define SUB_SEGMENT_ALIGN(SEG)					\
--- 130,141 ----
  extern int tc_coff_sizemachdep PARAMS ((fragS *));
  
  #ifdef BFD_ASSEMBLER
! #define SUB_SEGMENT_ALIGN(SEG) 				\
!   (strncmp (segment_name (SEG), ".stabstr", 8) == 0 ? 0	\
!    : (   (strncmp (segment_name (SEG), ".stab", 5) == 0	\
!        || strcmp (segment_name (SEG), ".ctors") == 0	\
!        || strcmp (segment_name (SEG), ".dtors") == 0)	\
!       ? 2 : 4))
  #else
  /* We align most sections to a 16 byte boundary.  */
  #define SUB_SEGMENT_ALIGN(SEG)					\

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