* write.c (subsegs_finish): For SEC_MERGE sections pad last fragment
authorJakub Jelinek <jakub@redhat.com>
Thu, 28 Nov 2002 14:13:51 +0000 (14:13 +0000)
committerJakub Jelinek <jakub@redhat.com>
Thu, 28 Nov 2002 14:13:51 +0000 (14:13 +0000)
to entsize.

gas/ChangeLog
gas/write.c

index cdf5c9efe017f840ad8a9f2a2ed1988b63486c7e..588c39d7ba4b8bb427bdc956d49f4e7b7f188ba8 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-28  Jakub Jelinek  <jakub@redhat.com>
+
+       * write.c (subsegs_finish): For SEC_MERGE sections pad last fragment
+       to entsize.
+
 2002-11-26  DJ Delorie  <dj@redhat.com.
 
        * dwarf2dbg.c (scale_addr_delta): New.
index b1c27d78b52e508fbffdc1752553346bd5d9d1da..40c18f81d06a817458dd05476c39932b4234f279 100644 (file)
@@ -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)
+             && now_seg->entsize)
+           {
+             unsigned int entsize = now_seg->entsize;
+             int entalign = 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);