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

workaround for memory error in GAS


I've committed this patch to avoid an infrequent memory error in the Xtensa port of GAS. It looks like the i960 and v850 ports may suffer from the same problem, since it occurs when HANDLE_ALIGN is defined but MAX_MEM_FOR_RS_ALIGN_CODE is not. Unfortunately, I do not have a testcase to demonstrate the problem, since Sterling tracked this down in an older version of GAS and told me that it was difficult to reproduce. (This was happening from subsegs_finish where writing one byte past the end of a frag is usually only fatal when it is at the end of an obstack chunk.)

The default definition of MAX_MEM_FOR_RS_ALIGN_CODE in this case is:

# define MAX_MEM_FOR_RS_ALIGN_CODE ((1 << alignment) - 1)

If the value of "alignment" is zero, the value of MAX_MEM_FOR_RS_ALIGN_CODE is also zero, but it needs to be at least one byte for the call to frag_var in frag_align_code. There are at least some cases where frag_align_code is called from subsegs_finish with an alignment of zero. A more general solution might be to change the default to:

(alignment == 0 ? 1 : (1 << alignment) - 1)

but the Xtensa port should really have MAX_MEM_FOR_RS_ALIGN_CODE set to 1 regardless.

2005-12-29 Sterling Augustine <sterling@tensilica.com>

* config/tc-xtensa.h (MAX_MEM_FOR_RS_ALIGN_CODE): Define.


Attachment: gas-memerror-fix.diff
Description: Binary data


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