]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Enable 64-bit archives in ar and ranlib
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 25 May 2016 16:46:47 +0000 (09:46 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 25 May 2016 16:47:03 +0000 (09:47 -0700)
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 force 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.

14 files changed:
bfd/ChangeLog
bfd/archive.c
bfd/archive64.c
bfd/config.in
bfd/configure
bfd/configure.ac
bfd/elf64-mips.c
bfd/elf64-s390.c
bfd/elfxx-target.h
bfd/libbfd-in.h
bfd/libbfd.h
bfd/plugin.c
binutils/ChangeLog
binutils/NEWS

index f01cf1e469a4181815e52d2dbedf9d34aa5cc6b3..e478afbd5c9abeb6a7718816bfd1a63b7318fd23 100644 (file)
@@ -1,3 +1,65 @@
+2016-05-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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.
+
 2016-05-25  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/20103
index 53e295eb26c0b66741803400e92df496b096b527..6fc5f1d80f9ef8be456c45b35bcea42ff3436086 100644 (file)
@@ -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 is 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,42 @@ 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 is 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 +2766,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
index 3192f401a5f5144a50319cff315acca62b83aa37..be1ac7ce685180b89d9c033b7a616edb5be143a6 100644 (file)
@@ -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"
 /* 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;
index cffadbb21920b3b3fc9a63eb89a7c282b6ba35b6..341afae432957e52e8dde2ee3161d14b38a367bf 100644 (file)
 /* 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
 
index f8617b9534295d6e6772d706ce32b0e5476e982c..fab203d9bfb119c122376689340e2ea4f62a09eb 100755 (executable)
@@ -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 force 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,17 @@ if test "${enable_targets+set}" = set; then :
 esac
 fi
 
+# 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 +14609,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
index f57d4d78dc2473f1a6687940208c7f7e6e5886f2..103624857614688f387b13c445a05e5ee769718c 100644 (file)
@@ -68,6 +68,15 @@ AC_ARG_ENABLE(targets,
   *)        enable_targets=$enableval ;;
 esac])dnl
 
+AC_ARG_ENABLE(64_bit_archive,
+             AS_HELP_STRING([--enable-64-bit-archive],
+             [force 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 +784,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
index 6bedebcab5548aeebeec9dce1720e5b2f4209d49..34144f038b6bb0804b9452cb0d52652e1f8bc90d 100644 (file)
@@ -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"
index b085169b8be077e939fa7cf724f2118dd01d6032..39509392ffa249a43636adb2d19ef0b181b97e72 100644 (file)
@@ -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"
index 0dc4f75aeaef7e30ab012d2253da6a0b7cfbbfff..97aa5e690bf6c8ab400796b4a01cedebd0a8b03d 100644 (file)
@@ -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
index 5f2886339fe32178b4c6e13abdf21a6d41f5b183..8644d8d045e48db30a0897b2858f12c7495ca00c 100644 (file)
@@ -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
index 33490c07f9b623caf6a6b6b4c1d2ae1f76816281..bf17f4353411fc398f357ec39423859c63009198 100644 (file)
@@ -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
index fd7bac04ece081d124abf3b13597def9cfc13865..c81a2678256d0d5709c358bd5334b8cb91163c2d 100644 (file)
@@ -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),
index 64b409e26dd97fb3d5c3bed8f609240c2a1ac418..352e2b0bc2f6dbbd2b26bc39c358401f8da6ac29 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-25  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/14625
+       * NEWS: Mention --enable-64-bit-archive.
+
 2016-05-18  Nick Clifton  <nickc@redhat.com>
 
        PR 20096
index 712604b0e4d7e327a9e0e6bd12785d3470b798c1..f2348fb8575694c4b4dabb74aedce2c789cf391d 100644 (file)
@@ -1,5 +1,8 @@
 -*- text -*-
 
+* Add a configure option, --enable-64-bit-archive, to force use of a
+  64-bit format when creating an archive symbol index.
+
 * Add --elf-stt-common= option to objcopy for ELF targets to control
   whether to convert common symbols to the STT_COMMON type.