This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: Fix for alignment of .stab section in sh-pe gas
- To: amylaar at cygnus dot co dot uk
- Subject: Re: Fix for alignment of .stab section in sh-pe gas
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 29 Mar 2000 13:07:38 -0800
- CC: binutils at sourceware dot cygnus dot com
Hi Joern,
: -small reduces the alignment of the sections from p2align 4 to p2align 2.
: Adding support for it should be as simple as backing out your tc-sh.h patch
: from the 24th Febuary.
Except that the sh-wince-pe toolchain uses a BFD_ASSEMBLER so the
definition of SUB_SEGMENT_ALIGN prior to Feb 24 wll not work.
However it is very easy to add the test of sh_small to the new
version proposed in my patch, so I have attached an amended version
below.
: > No its the former. The presence of the alignment frags in the .stab
: > section upsets the alignment of the section when it is generated later
:
: What do you mean with 'upsets the alignment'? Is it just that the
: alignment gets increased to fit the largest item contained in the section?
: Or does it warn that it can't accomodate the larger alignment inside?
: Or does it generate an incorrect data layout?
Actually you are right, this part of the patch was unnecessary, since
the alignment frag did not affect the overall alinment of the section.
So, what do you think of this revised patch ?
Cheers
Nick
2000-03-29 Nick Clifton <nickc@cygnus.com>
* config/tc-sh.h (SEG_NAME): New macro: return the name of a
segment. Works for both BFD_ASSEMBLER and others.
(SUB_SEGMENT_ALIGN): Use SEG_NAME.
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 21:06:56
*************** extern void sh_coff_reloc_mangle
*** 130,147 ****
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) \
! (strncmp (obj_segment_name (SEG), ".stabstr", 8) == 0 \
! ? 0 \
! : ((strncmp (obj_segment_name (SEG), ".stab", 5) == 0 \
! || strcmp (obj_segment_name (SEG), ".ctors") == 0 \
! || strcmp (obj_segment_name (SEG), ".dtors") == 0) \
! ? 2 \
: (sh_small ? 2 : 4)))
- #endif
#endif /* OBJ_COFF */
--- 130,149 ----
extern int tc_coff_sizemachdep PARAMS ((fragS *));
#ifdef BFD_ASSEMBLER
! #define SEG_NAME(SEG) segment_name (SEG)
#else
+ #define SEG_NAME(SEG) obj_segment_name (SEG)
+ #endif
+
/* We align most sections to a 16 byte boundary. */
! #define SUB_SEGMENT_ALIGN(SEG) \
! (strncmp (SEG_NAME (SEG), ".stabstr", 8) == 0 \
! ? 0 \
! : ((strncmp (SEG_NAME (SEG), ".stab", 5) == 0 \
! || strcmp (SEG_NAME (SEG), ".ctors") == 0 \
! || strcmp (SEG_NAME (SEG), ".dtors") == 0) \
! ? 2 \
: (sh_small ? 2 : 4)))
#endif /* OBJ_COFF */