This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Pad SEC_MERGE sections to entsize boundary in gas
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Cc: Ulrich Drepper <drepper at redhat dot com>
- Date: Sun, 24 Nov 2002 22:41:59 +0100
- Subject: [PATCH] Pad SEC_MERGE sections to entsize boundary in gas
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Ulrich found long double constants on IA-32 in .rodata.cst16 section
cause the section not to be multiple of sh_entsize.
Although ld SHF_MERGE merging code handles this gracefully by assuming
zero padding, sh_size should be multiple of sh_entsize.
The following patch adds the padding if it was not already provided in
assembly.
Ok to commit?
2002-11-24 Jakub Jelinek <jakub@redhat.com>
* write.c (subsegs_finish): For SEC_MERGE sections pad last fragment
to entsize.
--- gas/write.c.jj 2002-11-21 15:58:39.000000000 +0100
+++ gas/write.c 2002-11-24 23:54:58.000000000 +0100
@@ -1409,7 +1409,25 @@ subsegs_finish ()
any alignment is meaningless, and, moreover, will look weird
if we are generating a listing. */
if (!had_errors ())
- alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP);
+ {
+ alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP);
+#ifdef BFD_ASSEMBLER
+ if (bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE)
+ {
+ unsigned int entsize = now_seg->entsize;
+ int entalign = 0;
+
+ know (entsize != 0);
+ while ((entsize & 1) == 0)
+ {
+ ++entalign;
+ entsize >>= 1;
+ }
+ if (entalign > alignment)
+ alignment = entalign;
+ }
+#endif
+ }
if (subseg_text_p (now_seg))
frag_align_code (alignment, 0);
Jakub