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]

Re: [PATCH] Sparc32 ELF TLS fixes


On Wed, Apr 13, 2005 at 12:13:40PM -0700, David S. Miller wrote:
> For the test case we end up with size at 27 which is not aligned to
> a multiple of 8 of course.

Hmm, we do usually round up section size according to alignment in the
assembler, so this does qualify as a minor bug.  I call it minor because
padding at the end of a section won't affect anything except placement
of following sections.  The placement isn't wrong for your testcase,
just different from that when using the srec linker.

> Alan, this problem seems to have been introduced by your _raw_size changes
> (revision 1.20 --> 1.21 of bfd/merge.c on June 24, 2004).  That line at the
> end of the loop quoted above which sets "secinfo->sec->size = size;" came
> from those changes.

I don't think this patch changed section sizing for this testcase.
However, since you're dragging me into this I may as well fix it.  :)

	* merge.c (merge_strings): Round up section size for alignment.

Um, after applying this I'm wondering whether we need to bfd_bwrite the
zero bytes?  I know lseek should put zeros in gaps, but I have a nagging
feeling that not all operating systems we support do this.  Anyone?

Index: bfd/merge.c
===================================================================
RCS file: /cvs/src/src/bfd/merge.c,v
retrieving revision 1.22
diff -u -p -r1.22 merge.c
--- bfd/merge.c	20 Feb 2005 14:59:07 -0000	1.22
+++ bfd/merge.c	13 Apr 2005 23:56:41 -0000
@@ -656,6 +656,11 @@ alloc_failure:
 	}
     }
   secinfo->sec->size = size;
+  if (secinfo->sec->alignment_power != 0)
+    {
+      bfd_size_type align = (bfd_size_type) 1 << secinfo->sec->alignment_power;
+      secinfo->sec->size = (secinfo->sec->size + align - 1) & -align;
+    }
 
   /* And now adjust the rest, removing them from the chain (but not hashtable)
      at the same time.  */

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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