Commit: Fix creation of index tables for 64-bit thin archives

Nick Clifton nickc@redhat.com
Mon Mar 4 09:21:00 GMT 2013


Hi Guys,

  I am applying the patch below to fix the creation of index tables in
  64-bit thin archives.  Thin archives do not include the body of the
  objects being archives, so the body size should not be included in the
  index calculation.

Cheers
  Nick

bfd/ChangeLog
2013-03-04  Nick Clifton  <nickc@redhat.com>

	* archive64.c (bfd_elf64_archive_write_armap): Fix calculation of
	file pointer offsets for thin archives.

Index: bfd/archive64.c
===================================================================
RCS file: /cvs/src/src/bfd/archive64.c,v
retrieving revision 1.16
diff -u -3 -p -r1.16 archive64.c
--- bfd/archive64.c	20 Aug 2012 14:32:30 -0000	1.16
+++ bfd/archive64.c	1 Mar 2013 17:14:00 -0000
@@ -210,9 +209,11 @@ bfd_elf64_archive_write_armap (bfd *arch
 	  if (bfd_bwrite (buf, 8, arch) != 8)
 	    return FALSE;
 	}
+
       /* Add size of this archive entry */
-      archive_member_file_ptr += (arelt_size (current)
-				  + sizeof (struct ar_hdr));
+      archive_member_file_ptr += sizeof (struct ar_hdr);
+      if (! bfd_is_thin_archive (arch))
+	archive_member_file_ptr += arelt_size (current);
       /* remember about the even alignment */
       archive_member_file_ptr += archive_member_file_ptr % 2;
     }



More information about the Binutils mailing list