This is the mail archive of the binutils@sourceware.org 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] PR binutils/14625: Enable 64-bit archives in ar and ranlib


On Tue, May 24, 2016 at 10:03 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, May 23, 2016 at 2:42 AM, Alan Modra <amodra@gmail.com> wrote:
>> On Fri, May 20, 2016 at 05:10:02AM -0700, H.J. Lu wrote:
>>> Since existing ld and gold support the 64-bit (MIPS) ELF archives, we
>>> can use the 64-bit (MIPS) ELF archives as 64-bit archives.  Since the
>>> plugin target is used to create archive in plugin-enabled ar, we need
>>> a way to enable 64-bit archives in the plugin target.  This patch adds
>>> --enable-64-bit-archive to bfd to enable 64-bit archives in ar and
>>> ranlib.  Since both 64-bit MIPS and s390 ELF targets currently use
>>> 64-bit archives, all Linux linkers with 64-bit BFD support both 32-bit
>>> and 64-bit archives, 64-bit archives are enabled by default for them.
>>
>> Hmm, isn't it true that archive64.c is compiled in for any 64-bit
>> target?  I also don't see anything ELF specific in archive64.c.
>
> That is correct.
>
>>> +  # Since all Linux linkers support both 32-bit and 64-bit archives,
>>> +  # it is safe to enable 64-bit archives for Linux targets with 64-bit
>>> +  # bfd_vma.
>>> +  case "${target}${want64}" in
>>> +    *linux*true)
>>> +      want_64_bit_archive=true
>>> +      ;;
>>> +  esac
>>> +fi
>>
>> So the above could just set want_64_bit_archive based on want64,
>> ignoring target, except that doing so might result in archives that
>> aren't recognized by native tools.  How about instead of this
>> configure option, changing _bfd_compute_and_write_armap to choose the
>> archive64.c write_armap whenever the archive size is larger than 2G?
>
> The limit is 4GB, not 2GB.  The limit is the offset of an archive member,
> not the size of archive.  We can have an archive > 4GB with archive
> member offsets < 4GB.
>
>> I think that might just work automatically.
>>
>> The rest of the patch looks reasonable except that you missed changing
>> elf64-ia64-vms.c, and I think the libbfd-in.h defines would be better
>
> Since elf64-ia64-vms.c uses _bfd_vms_lib_write_armap which is defined as
> NULL, i prefer to leave it unchanged.
>
>> with the coff defines substituted.  eg. _bfd_slurp_extended_name_table
>> rather than _bfd_archive_coff_slurp_extended_name_table.
>>
>
> Good point.  Here is the updated patch.  OK for master?
>

This patch generates 64-bit archive automatically.


-- 
H.J.
From 8a3f07d331c893ab9ff5e782a16172e3ffa7c9c5 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 19 May 2016 13:34:11 -0700
Subject: [PATCH] Enable 64-bit archives in ar and ranlib

Since existing ld and gold support the 64-bit (MIPS) ELF archives, we
can use the 64-bit (MIPS) ELF archives as 64-bit archives.  Since the
plugin target is used to create archive in plugin-enabled ar, we need
a way to enable 64-bit archives in the plugin target.  This patch adds
--enable-64-bit-archive to bfd to enable 64-bit archives in ar and
ranlib.  Since both 64-bit MIPS and s390 ELF targets currently use
64-bit archives, 64-bit archives are enabled by default for them.
64-bit archive is generated automatically if the archive is too big.

Tested on Linux/x86 and Linux/x86-64 with existing ld and gold.

bfd/

	PR binutils/14625
	* archive.c (bfd_slurp_armap): Replace
	bfd_elf64_archive_slurp_armap with
	_bfd_archive_64_bit_slurp_armap.
	(bsd_write_armap): Call _bfd_archive_64_bit_write_armap if
	BFD64 is defined and the archive is too big.
	(coff_write_armap): Likewise.
	* archive64.c (bfd_elf64_archive_slurp_armap): Renamed to ...
	(_bfd_archive_64_bit_slurp_armap): This.
	(bfd_elf64_archive_write_armap): Renamed to ...
	(_bfd_archive_64_bit_write_armap): This.
	* configure.ac: Add --enable-64-bit-archive.
	(want_64_bit_archive): New.  Set to true by default for 64-bit
	MIPS and s390 ELF targets.
	(USE_64_BIT_ARCHIVE): New AC_DEFINE.
	* config.in: Regenerated.
	* configure: Likewise.
	* elf64-mips.c (bfd_elf64_archive_functions): Removed.
	(bfd_elf64_archive_slurp_armap): Likewise.
	(bfd_elf64_archive_write_armap): Likewise.
	(bfd_elf64_archive_slurp_extended_name_table): Likewise.
	(bfd_elf64_archive_construct_extended_name_table): Likewise.
	(bfd_elf64_archive_truncate_arname): Likewise.
	(bfd_elf64_archive_read_ar_hdr): Likewise.
	(bfd_elf64_archive_write_ar_hdr): Likewise.
	(bfd_elf64_archive_openr_next_archived_file): Likewise.
	(bfd_elf64_archive_get_elt_at_index): Likewise.
	(bfd_elf64_archive_generic_stat_arch_elt): Likewise.
	(bfd_elf64_archive_update_armap_timestamp): Likewise.
	* elf64-s390.c (bfd_elf64_archive_functions): Removed.
	(bfd_elf64_archive_slurp_armap): Likewise.
	(bfd_elf64_archive_write_armap): Likewise.
	(bfd_elf64_archive_slurp_extended_name_table): Likewise.
	(bfd_elf64_archive_construct_extended_name_table): Likewise.
	(bfd_elf64_archive_truncate_arname): Likewise.
	(bfd_elf64_archive_read_ar_hdr): Likewise.
	(bfd_elf64_archive_write_ar_hdr): Likewise.
	(bfd_elf64_archive_openr_next_archived_file): Likewise.
	(bfd_elf64_archive_get_elt_at_index): Likewise.
	(bfd_elf64_archive_generic_stat_arch_elt): Likewise.
	(bfd_elf64_archive_update_armap_timestamp): Likewise.
	* elfxx-target.h (TARGET_BIG_SYM): Use _bfd_archive_64_bit on
	BFD_JUMP_TABLE_ARCHIVE if USE_64_BIT_ARCHIVE is defined and
	bfd_elfNN_archive_functions isn't defined.
	(TARGET_LITTLE_SYM): Likewise.
	* libbfd-in.h (_bfd_archive_64_bit_slurp_armap): New prototype.
	(_bfd_archive_64_bit_write_armap): Likewise.
	(_bfd_archive_64_bit_slurp_extended_name_table): New macro.
	(_bfd_archive_64_bit_construct_extended_name_table): Likewise.
	(_bfd_archive_64_bit_truncate_arname): Likewise.
	(_bfd_archive_64_bit_read_ar_hdr): Likewise.
	(_bfd_archive_64_bit_write_ar_hdr): Likewise.
	(_bfd_archive_64_bit_openr_next_archived_file): Likewise.
	(_bfd_archive_64_bit_get_elt_at_index): Likewise.
	(_bfd_archive_64_bit_generic_stat_arch_elt): Likewise.
	(_bfd_archive_64_bit_update_armap_timestamp): Likewise.
	* libbfd.h: Regenerated.
	* plugin.c (plugin_vec): Use _bfd_archive_64_bit on
	BFD_JUMP_TABLE_ARCHIVE if USE_64_BIT_ARCHIVE is defined.

binutils/

	PR binutils/14625
	* NEWS: Mention --enable-64-bit-archive.
---
 bfd/archive.c      | 91 +++++++++++++++++++++++++++++++++++++++++++++++-------
 bfd/archive64.c    | 21 ++++++-------
 bfd/config.in      |  3 ++
 bfd/configure      | 36 +++++++++++++++++++--
 bfd/configure.ac   | 27 ++++++++++++++++
 bfd/elf64-mips.c   | 23 --------------
 bfd/elf64-s390.c   | 15 ---------
 bfd/elfxx-target.h |  4 +++
 bfd/libbfd-in.h    | 23 ++++++++++++++
 bfd/libbfd.h       | 23 ++++++++++++++
 bfd/plugin.c       |  4 +++
 binutils/NEWS      |  3 ++
 12 files changed, 210 insertions(+), 63 deletions(-)

diff --git a/bfd/archive.c b/bfd/archive.c
index 53e295e..e620905 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1144,10 +1144,9 @@ bfd_slurp_armap (bfd *abfd)
     return do_slurp_coff_armap (abfd);
   else if (CONST_STRNEQ (nextname, "/SYM64/         "))
     {
-      /* 64bit ELF (Irix 6) archive.  */
+      /* 64bit (Irix 6) archive.  */
 #ifdef BFD64
-      extern bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
-      return bfd_elf64_archive_slurp_armap (abfd);
+      return _bfd_archive_64_bit_slurp_armap (abfd);
 #else
       bfd_set_error (bfd_error_wrong_format);
       return FALSE;
@@ -2466,15 +2465,49 @@ bsd_write_armap (bfd *arch,
   unsigned int stringsize = stridx + padit;
   /* Include 8 bytes to store ranlibsize and stringsize in output.  */
   unsigned int mapsize = ranlibsize + stringsize + 8;
-  file_ptr firstreal;
-  bfd *current = arch->archive_head;
-  bfd *last_elt = current;	/* Last element arch seen.  */
+  file_ptr firstreal, first;
+  bfd *current;
+  bfd *last_elt;
   bfd_byte temp[4];
   unsigned int count;
   struct ar_hdr hdr;
   long uid, gid;
 
-  firstreal = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
+  first = mapsize + elength + sizeof (struct ar_hdr) + SARMAG;
+
+#ifdef BFD64
+  firstreal = first;
+  current = arch->archive_head;
+  last_elt = current;	/* Last element arch seen.  */
+  for (count = 0; count < orl_count; count++)
+    {
+      unsigned int offset;
+
+      if (map[count].u.abfd != last_elt)
+	{
+	  do
+	    {
+	      struct areltdata *ared = arch_eltdata (current);
+
+	      firstreal += (ared->parsed_size + ared->extra_size
+			    + sizeof (struct ar_hdr));
+	      firstreal += firstreal % 2;
+	      current = current->archive_next;
+	    }
+	  while (current != map[count].u.abfd);
+	}
+
+      /* The archive file format only has 4 bytes to store the offset
+	 of the member.  Generate 64-bit archive if an archive past its
+	 4Gb limit.  */
+      offset = (unsigned int) firstreal;
+      if (firstreal != (file_ptr) offset)
+	return _bfd_archive_64_bit_write_armap (arch, elength, map,
+						orl_count, stridx);
+
+      last_elt = current;
+    }
+#endif
 
   /* If deterministic, we use 0 as the timestamp in the map.
      Some linkers may require that the archive filesystem modification
@@ -2513,6 +2546,9 @@ bsd_write_armap (bfd *arch,
   if (bfd_bwrite (temp, sizeof (temp), arch) != sizeof (temp))
     return FALSE;
 
+  firstreal = first;
+  current = arch->archive_head;
+  last_elt = current;	/* Last element arch seen.  */
   for (count = 0; count < orl_count; count++)
     {
       unsigned int offset;
@@ -2654,6 +2690,7 @@ coff_write_armap (bfd *arch,
   unsigned int stringsize = stridx;
   unsigned int mapsize = stringsize + ranlibsize;
   file_ptr archive_member_file_ptr;
+  file_ptr first_archive_member_file_ptr;
   bfd *current = arch->archive_head;
   unsigned int count;
   struct ar_hdr hdr;
@@ -2663,10 +2700,41 @@ coff_write_armap (bfd *arch,
     mapsize++;
 
   /* Work out where the first object file will go in the archive.  */
-  archive_member_file_ptr = (mapsize
-			     + elength
-			     + sizeof (struct ar_hdr)
-			     + SARMAG);
+  first_archive_member_file_ptr = (mapsize
+				   + elength
+				   + sizeof (struct ar_hdr)
+				   + SARMAG);
+
+#ifdef BFD64
+  current = arch->archive_head;
+  count = 0;
+  archive_member_file_ptr = first_archive_member_file_ptr;
+  while (current != NULL && count < symbol_count)
+    {
+      /* For each symbol which is used defined in this object, write
+	 out the object file's address in the archive.  */
+
+      while (count < symbol_count && map[count].u.abfd == current)
+	{
+	  unsigned int offset = (unsigned int) archive_member_file_ptr;
+
+	  /* Generate 64-bit archive if an archive past its 4Gb limit.  */
+	  if (archive_member_file_ptr != (file_ptr) offset)
+	    return _bfd_archive_64_bit_write_armap (arch, elength, map,
+						    symbol_count, stridx);
+	  count++;
+	}
+      archive_member_file_ptr += sizeof (struct ar_hdr);
+      if (! bfd_is_thin_archive (arch))
+	{
+	  /* Add size of this archive entry.  */
+	  archive_member_file_ptr += arelt_size (current);
+	  /* Remember about the even alignment.  */
+	  archive_member_file_ptr += archive_member_file_ptr % 2;
+	}
+      current = current->archive_next;
+    }
+#endif
 
   memset (&hdr, ' ', sizeof (struct ar_hdr));
   hdr.ar_name[0] = '/';
@@ -2697,6 +2765,7 @@ coff_write_armap (bfd *arch,
 
   current = arch->archive_head;
   count = 0;
+  archive_member_file_ptr = first_archive_member_file_ptr;
   while (current != NULL && count < symbol_count)
     {
       /* For each symbol which is used defined in this object, write
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 3192f40..be1ac7c 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -1,4 +1,4 @@
-/* Support for 64-bit ELF archives.
+/* Support for 64-bit archives.
    Copyright (C) 1996-2016 Free Software Foundation, Inc.
    Ian Lance Taylor, Cygnus Support
    Linker support added by Mark Mitchell, CodeSourcery, LLC.
@@ -21,7 +21,8 @@
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-/* This file supports the 64-bit (MIPS) ELF archives.  */
+/* This file supports the 64-bit archives.  We use the same format as
+   the 64-bit (MIPS) ELF archives.  */
 
 #include "sysdep.h"
 #include "bfd.h"
@@ -31,14 +32,10 @@
 /* Irix 6 defines a 64bit archive map format, so that they can
    have archives more than 4 GB in size.  */
 
-bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
-bfd_boolean bfd_elf64_archive_write_armap
-  (bfd *, unsigned int, struct orl *, unsigned int, int);
-
 /* Read an Irix 6 armap.  */
 
 bfd_boolean
-bfd_elf64_archive_slurp_armap (bfd *abfd)
+_bfd_archive_64_bit_slurp_armap (bfd *abfd)
 {
   struct artdata *ardata = bfd_ardata (abfd);
   char nextname[17];
@@ -150,11 +147,11 @@ release_symdefs:
    linker crashes.  */
 
 bfd_boolean
-bfd_elf64_archive_write_armap (bfd *arch,
-			       unsigned int elength,
-			       struct orl *map,
-			       unsigned int symbol_count,
-			       int stridx)
+_bfd_archive_64_bit_write_armap (bfd *arch,
+				 unsigned int elength,
+				 struct orl *map,
+				 unsigned int symbol_count,
+				 int stridx)
 {
   unsigned int ranlibsize = (symbol_count * 8) + 8;
   unsigned int stringsize = stridx;
diff --git a/bfd/config.in b/bfd/config.in
index cffadbb..341afae 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -337,6 +337,9 @@
 /* Name of host specific header file to include in trad-core.c. */
 #undef TRAD_HEADER
 
+/* Define if we should use 64-bit archives. */
+#undef USE_64_BIT_ARCHIVE
+
 /* Use b modifier when opening binary files? */
 #undef USE_BINARY_FOPEN
 
diff --git a/bfd/configure b/bfd/configure
index f8617b9..ee6950b 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -789,6 +789,7 @@ enable_plugins
 enable_largefile
 enable_64_bit_bfd
 enable_targets
+enable_64_bit_archive
 with_mmap
 enable_secureplt
 enable_leading_mingw64_underscores
@@ -1442,6 +1443,7 @@ Optional Features:
   --disable-largefile     omit support for large files
   --enable-64-bit-bfd     64-bit support (on hosts with narrower word sizes)
   --enable-targets        alternative target configurations
+  --enable-64-bit-archive use 64-bit archives
   --enable-secureplt      Default to creating read-only plt entries
   --enable-leading-mingw64-underscores
                           Enable leading underscores on 64 bit mingw targets
@@ -11425,7 +11427,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11428 "configure"
+#line 11430 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11531,7 +11533,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11534 "configure"
+#line 11536 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12129,6 +12131,19 @@ if test "${enable_targets+set}" = set; then :
 esac
 fi
 
+# Since the plugin target is used to create archive in plugin-enabled
+# ar, we need a way to enable 64-bit archives in the plugin target.
+# Check whether --enable-64_bit_archive was given.
+if test "${enable_64_bit_archive+set}" = set; then :
+  enableval=$enable_64_bit_archive; case "${enableval}" in
+  yes)  want_64_bit_archive=true  ;;
+  no)   want_64_bit_archive=false ;;
+  *)    as_fn_error "bad value ${enableval} for 64-bit-archive option" "$LINENO" 5 ;;
+esac
+else
+  want_64_bit_archive=unset
+fi
+
 
 # Check whether --with-mmap was given.
 if test "${with_mmap+set}" = set; then :
@@ -14596,6 +14611,23 @@ else	# all_targets is true
     selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
 fi	# all_targets is true
 
+if test "x$want_64_bit_archive" = xunset; then
+  # 64-bit MIPS and s390 ELF targets use 64-bit archives.
+  case "${bfd_backends}" in
+    *elf64-mips* | *elf64-s390*)
+      want_64_bit_archive=true
+      ;;
+  esac
+fi
+
+# 64-bit archives need a 64-bit bfd_vma.
+if test "x$want_64_bit_archive" = xtrue; then
+  want64=true
+
+$as_echo "#define USE_64_BIT_ARCHIVE 1" >>confdefs.h
+
+fi
+
 case ${host64}-${target64}-${want64} in
   *true*)
     wordsize=64
diff --git a/bfd/configure.ac b/bfd/configure.ac
index f57d4d7..6e3593f 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -68,6 +68,17 @@ AC_ARG_ENABLE(targets,
   *)        enable_targets=$enableval ;;
 esac])dnl
 
+# Since the plugin target is used to create archive in plugin-enabled
+# ar, we need a way to enable 64-bit archives in the plugin target.
+AC_ARG_ENABLE(64_bit_archive,
+	      AS_HELP_STRING([--enable-64-bit-archive],
+	      [use 64-bit archives]),
+[case "${enableval}" in
+  yes)  want_64_bit_archive=true  ;;
+  no)   want_64_bit_archive=false ;;
+  *)    AC_MSG_ERROR(bad value ${enableval} for 64-bit-archive option) ;;
+esac],[want_64_bit_archive=unset])dnl
+
 AC_ARG_WITH(mmap,
 [  --with-mmap             try using mmap for BFD input files if available],
 [case "${withval}" in
@@ -775,6 +786,22 @@ else	# all_targets is true
     selarchs=`echo $selarchs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
 fi	# all_targets is true
 
+if test "x$want_64_bit_archive" = xunset; then
+  # 64-bit MIPS and s390 ELF targets use 64-bit archives.
+  case "${bfd_backends}" in
+    *elf64-mips* | *elf64-s390*)
+      want_64_bit_archive=true
+      ;;
+  esac
+fi
+
+# 64-bit archives need a 64-bit bfd_vma.
+if test "x$want_64_bit_archive" = xtrue; then
+  want64=true
+  AC_DEFINE(USE_64_BIT_ARCHIVE, 1,
+    [Define if we should use 64-bit archives.])
+fi
+
 case ${host64}-${target64}-${want64} in
   *true*)
     wordsize=64
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index 6bedebc..34144f0 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -4478,29 +4478,6 @@ const struct elf_size_info mips_elf64_size_info =
 #define bfd_elf64_bfd_relax_section     _bfd_mips_relax_section
 #define bfd_elf64_mkobject		_bfd_mips_elf_mkobject
 
-/* MIPS ELF64 archive functions.  */
-#define bfd_elf64_archive_functions
-extern bfd_boolean bfd_elf64_archive_slurp_armap
-  (bfd *);
-extern bfd_boolean bfd_elf64_archive_write_armap
-  (bfd *, unsigned int, struct orl *, unsigned int, int);
-#define bfd_elf64_archive_slurp_extended_name_table \
-			_bfd_archive_coff_slurp_extended_name_table
-#define bfd_elf64_archive_construct_extended_name_table \
-			_bfd_archive_coff_construct_extended_name_table
-#define bfd_elf64_archive_truncate_arname \
-			_bfd_archive_coff_truncate_arname
-#define bfd_elf64_archive_read_ar_hdr	_bfd_archive_coff_read_ar_hdr
-#define bfd_elf64_archive_write_ar_hdr	_bfd_archive_coff_write_ar_hdr
-#define bfd_elf64_archive_openr_next_archived_file \
-			_bfd_archive_coff_openr_next_archived_file
-#define bfd_elf64_archive_get_elt_at_index \
-			_bfd_archive_coff_get_elt_at_index
-#define bfd_elf64_archive_generic_stat_arch_elt \
-			_bfd_archive_coff_generic_stat_arch_elt
-#define bfd_elf64_archive_update_armap_timestamp \
-			_bfd_archive_coff_update_armap_timestamp
-
 /* The SGI style (n)64 NewABI.  */
 #define TARGET_LITTLE_SYM		mips_elf64_le_vec
 #define TARGET_LITTLE_NAME		"elf64-littlemips"
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index b085169..3950939 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -3955,19 +3955,4 @@ const struct elf_size_info s390_elf64_size_info =
 #define bfd_elf64_mkobject		elf_s390_mkobject
 #define elf_backend_object_p		elf_s390_object_p
 
-/* Enable ELF64 archive functions.  */
-#define bfd_elf64_archive_functions
-extern bfd_boolean bfd_elf64_archive_slurp_armap (bfd *);
-extern bfd_boolean bfd_elf64_archive_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int);
-
-#define bfd_elf64_archive_slurp_extended_name_table 	_bfd_archive_coff_slurp_extended_name_table
-#define bfd_elf64_archive_construct_extended_name_table _bfd_archive_coff_construct_extended_name_table
-#define bfd_elf64_archive_truncate_arname 		_bfd_archive_coff_truncate_arname
-#define bfd_elf64_archive_read_ar_hdr			_bfd_archive_coff_read_ar_hdr
-#define bfd_elf64_archive_write_ar_hdr			_bfd_archive_coff_write_ar_hdr
-#define bfd_elf64_archive_openr_next_archived_file 	_bfd_archive_coff_openr_next_archived_file
-#define bfd_elf64_archive_get_elt_at_index 		_bfd_archive_coff_get_elt_at_index
-#define bfd_elf64_archive_generic_stat_arch_elt 	_bfd_archive_coff_generic_stat_arch_elt
-#define bfd_elf64_archive_update_armap_timestamp 	_bfd_archive_coff_update_armap_timestamp
-
 #include "elf64-target.h"
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 0dc4f75..97aa5e6 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -926,6 +926,8 @@ const bfd_target TARGET_BIG_SYM =
   BFD_JUMP_TABLE_CORE (bfd_elfNN),
 #ifdef bfd_elfNN_archive_functions
   BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
+#elif defined USE_64_BIT_ARCHIVE
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_64_bit),
 #else
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
 #endif
@@ -1025,6 +1027,8 @@ const bfd_target TARGET_LITTLE_SYM =
   BFD_JUMP_TABLE_CORE (bfd_elfNN),
 #ifdef bfd_elfNN_archive_functions
   BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive),
+#elif defined USE_64_BIT_ARCHIVE
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_64_bit),
 #else
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
 #endif
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 5f28863..8644d8d 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -149,6 +149,29 @@ bfd_boolean bfd_slurp_bsd_armap_f2
   (bfd *abfd);
 #define bfd_slurp_bsd_armap bfd_slurp_armap
 #define bfd_slurp_coff_armap bfd_slurp_armap
+bfd_boolean _bfd_archive_64_bit_slurp_armap
+  (bfd *);
+bfd_boolean _bfd_archive_64_bit_write_armap
+  (bfd *, unsigned int, struct orl *, unsigned int, int);
+#define _bfd_archive_64_bit_slurp_extended_name_table \
+  _bfd_slurp_extended_name_table
+#define _bfd_archive_64_bit_construct_extended_name_table \
+  _bfd_archive_coff_construct_extended_name_table
+#define _bfd_archive_64_bit_truncate_arname \
+  bfd_dont_truncate_arname
+#define _bfd_archive_64_bit_read_ar_hdr \
+  _bfd_generic_read_ar_hdr
+#define _bfd_archive_64_bit_write_ar_hdr \
+  _bfd_generic_write_ar_hdr
+#define _bfd_archive_64_bit_openr_next_archived_file \
+  bfd_generic_openr_next_archived_file
+#define _bfd_archive_64_bit_get_elt_at_index \
+  _bfd_generic_get_elt_at_index
+#define _bfd_archive_64_bit_generic_stat_arch_elt \
+  bfd_generic_stat_arch_elt
+#define _bfd_archive_64_bit_update_armap_timestamp \
+  bfd_true
+
 bfd_boolean _bfd_slurp_extended_name_table
   (bfd *abfd);
 extern bfd_boolean _bfd_construct_extended_name_table
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 33490c0..bf17f43 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -154,6 +154,29 @@ bfd_boolean bfd_slurp_bsd_armap_f2
   (bfd *abfd);
 #define bfd_slurp_bsd_armap bfd_slurp_armap
 #define bfd_slurp_coff_armap bfd_slurp_armap
+bfd_boolean _bfd_archive_64_bit_slurp_armap
+  (bfd *);
+bfd_boolean _bfd_archive_64_bit_write_armap
+  (bfd *, unsigned int, struct orl *, unsigned int, int);
+#define _bfd_archive_64_bit_slurp_extended_name_table \
+  _bfd_slurp_extended_name_table
+#define _bfd_archive_64_bit_construct_extended_name_table \
+  _bfd_archive_coff_construct_extended_name_table
+#define _bfd_archive_64_bit_truncate_arname \
+  bfd_dont_truncate_arname
+#define _bfd_archive_64_bit_read_ar_hdr \
+  _bfd_generic_read_ar_hdr
+#define _bfd_archive_64_bit_write_ar_hdr \
+  _bfd_generic_write_ar_hdr
+#define _bfd_archive_64_bit_openr_next_archived_file \
+  bfd_generic_openr_next_archived_file
+#define _bfd_archive_64_bit_get_elt_at_index \
+  _bfd_generic_get_elt_at_index
+#define _bfd_archive_64_bit_generic_stat_arch_elt \
+  bfd_generic_stat_arch_elt
+#define _bfd_archive_64_bit_update_armap_timestamp \
+  bfd_true
+
 bfd_boolean _bfd_slurp_extended_name_table
   (bfd *abfd);
 extern bfd_boolean _bfd_construct_extended_name_table
diff --git a/bfd/plugin.c b/bfd/plugin.c
index fd7bac0..c81a267 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -597,7 +597,11 @@ const bfd_target plugin_vec =
   BFD_JUMP_TABLE_GENERIC (bfd_plugin),
   BFD_JUMP_TABLE_COPY (bfd_plugin),
   BFD_JUMP_TABLE_CORE (bfd_plugin),
+#ifdef USE_64_BIT_ARCHIVE
+  BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_64_bit),
+#else
   BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+#endif
   BFD_JUMP_TABLE_SYMBOLS (bfd_plugin),
   BFD_JUMP_TABLE_RELOCS (_bfd_norelocs),
   BFD_JUMP_TABLE_WRITE (bfd_plugin),
diff --git a/binutils/NEWS b/binutils/NEWS
index 712604b..d119c1e 100644
--- a/binutils/NEWS
+++ b/binutils/NEWS
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* Add a configure option, --enable-64-bit-archive, to enable 64-bit
+  archives in ar and ranlib.
+
 * Add --elf-stt-common= option to objcopy for ELF targets to control
   whether to convert common symbols to the STT_COMMON type.
 
-- 
2.5.5


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