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] Fix s390{,x} ld-size-1 failures


Hi!

We were alocating just 15 bytes instead of (1 << alignment) - 1
(s390* MAX_MEM_FOR_RS_ALIGN_CODE), but then s390_align_code calls
      memset (fragP->fr_literal + fragP->fr_fix, 0x07, count);
with the whole count, not just at most 15 bytes.
This lead to potential corruption of any fragments following fragP.
Ok to commit?

2004-05-04  Jakub Jelinek  <jakub@redhat.com>

	* config/tc-s390.h (md_do_align): Pass (1 << n) - 1 instead of 15
	as max_chars to frag_var.

--- gas/config/tc-s390.h.jj	2003-07-10 15:03:13.000000000 +0200
+++ gas/config/tc-s390.h	2004-05-04 16:42:12.724802992 +0200
@@ -80,7 +80,7 @@ extern int target_big_endian;
 if ((n) && !need_pass_2 && (fill == 0) &&                               \
     (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) {     \
   char *p;                                                              \
-  p = frag_var (rs_align_code, 15, 1, (relax_substateT) max,            \
+  p = frag_var (rs_align_code, (1 << (n)) - 1, 1, (relax_substateT) max,\
                 (symbolS *) 0, (offsetT) (n), (char *) 0);              \
   *p = 0x07;                                                            \
   goto around;                                                          \

	Jakub


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