[Patch]: Enable vms/ia64 archives

Tristan Gingold gingold@adacore.com
Tue May 4 08:33:00 GMT 2010


Hi,

this patch enables the use of vms archives on ia64/vms.  The VMS specific part is trivial (all the work
was already committed), but there is an neighborhood issue: I think we don't want to include the vms
archive stuff while building for ia64-linux (or hpux).  There is already a per vector define flag, but
it was not added for all sources and not defined when --enable-targets=all was set.  With this patch,
havevecs is now separated from tdefaults and added to INCLUDES flags.  Furthermore the macro
HAVE_all_vecs is defined with --enable-targets=all.  Using conditional directive, the VMS stuff
in elfxx-ia64.c is compiled only when the VMS vector is selected (either by its own or through
--enable-targets=all).

To check this approach, I have build for ia64-openvms, ia64-linux and with --enable-targets=all.

Ok for mainline ?

Tristan.

bfd/
2010-05-04  Tristan Gingold  <gingold@adacore.com>

	* vms-lib.c (_bfd_vms_lib_ia64_archive_p): New function.
	* libbfd-in.h (_bfd_vms_lib_ia64_archive_p): Add prototype.
	* libbfd.h: Regenerate.
	* configure.in (havevecs): Define HAVE_all_vecs when
	--enable-targets=all is set.  Use AC_SUBST on it.
	(tdefaults): Do not add havevecs.
	(bfd_elf64_ia64_vms_vec): Add vms-lib.lo and vms-misc.lo
	* configure: Regenerate.
	* Makefile.in (tdefaults): Remove this unused variable.
	(HAVEVECS): New variable.
	(INCLUDES): Add HAVEVECS.
	* elfxx-ia64.c: Use #if/#endif around vms specific code.
	(bfd_elfNN_archive_p, bfd_elfNN_archive_slurp_armap,
	bfd_elfNN_archive_slurp_extended_name_table,
	bfd_elfNN_archive_construct_extended_name_table,
	bfd_elfNN_archive_truncate_arname,
	bfd_elfNN_archive_write_armap,
	bfd_elfNN_archive_read_ar_hdr,
	bfd_elfNN_archive_write_ar_hdr,
	bfd_elfNN_archive_openr_next_archived_file,
	bfd_elfNN_archive_get_elt_at_index,
	bfd_elfNN_archive_generic_stat_arch_elt,
	bfd_elfNN_archive_update_armap_timestamp): Define to use vms archives.

diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 7134a70..1c8ee65 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -309,7 +309,6 @@ target_cpu = @target_cpu@
 target_noncanonical = @target_noncanonical@
 target_os = @target_os@
 target_vendor = @target_vendor@
-tdefaults = @tdefaults@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
@@ -982,7 +981,9 @@ ALL_BACKENDS = @all_backends@
 BFD_BACKENDS = @bfd_backends@
 BFD_MACHINES = @bfd_machines@
 TDEFAULTS = @tdefaults@
-INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) @INCINTL@
+HAVEVECS = @havevecs@
+INCLUDES = @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) \
+  $(HAVEVECS) @INCINTL@
 
 # C source files that correspond to .o's.
 SOURCE_CFILES = \
diff --git a/bfd/configure.in b/bfd/configure.in
index 6f05505..dbbadc0 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -801,7 +801,7 @@ do
     bfd_elf64_ia64_big_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_ia64_little_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
-    bfd_elf64_ia64_vms_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
+    bfd_elf64_ia64_vms_vec)	tb="$tb elf64-ia64.lo elf64.lo vms-lib.lo vms-misc.lo $elf"; target_size=64 ;;
     bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
     bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
     bfd_elf64_mmix_vec) 	tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
@@ -992,7 +992,7 @@ if test x${all_targets} = xtrue ; then
   bfd_backends="${bfd_backends}"' $(ALL_BACKENDS)'
   bfd_machines="${bfd_machines}"' $(ALL_MACHINES)'
   selvecs=
-  havevecs=
+  havevecs=-DHAVE_all_vecs
   selarchs=
   test -n "$assocvecs" &&
     assocvecs=`echo $assocvecs | sed -e 's/^/\&/' -e 's/ \(.\)/,\&\1/g'`
@@ -1077,8 +1077,8 @@ test -n "${defvec}" && tdefaults="${tdefaults} -DDEFAULT_VECTOR=${defvec}"
 test -n "${selvecs}" && tdefaults="${tdefaults} -DSELECT_VECS='${selvecs}'"
 test -n "${assocvecs}" && tdefaults="${tdefaults} -DASSOCIATED_VECS='${assocvecs}'"
 test -n "${selarchs}" && tdefaults="${tdefaults} -DSELECT_ARCHITECTURES='${selarchs}'"
-test -n "${havevecs}" && tdefaults="${tdefaults} ${havevecs}"
 AC_SUBST(tdefaults)
+AC_SUBST(havevecs)
 
 dnl AC_CHECK_HEADERS(sys/mman.h)
 AC_FUNC_MMAP
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 7fde3d5..6ee4ac1 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -5723,6 +5723,8 @@ elfNN_hpux_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
     }
 }
 
+#if defined (HAVE_bfd_elf64_ia64_vms_vec) || defined (HAVE_all_vecs)
+
 static bfd_boolean
 elfNN_vms_section_from_shdr (bfd *abfd,
 			     Elf_Internal_Shdr *hdr,
@@ -5984,6 +5986,7 @@ elfNN_vms_close_and_cleanup (bfd *abfd)
 
   return _bfd_generic_close_and_cleanup (abfd);
 }
+#endif /* !(defined (HAVE_bfd_elf64_ia64_vms_vec) || defined (HAVE_all_vecs)) */
 
 #define TARGET_LITTLE_SYM		bfd_elfNN_ia64_little_vec
 #define TARGET_LITTLE_NAME		"elfNN-ia64-little"
@@ -6117,6 +6120,7 @@ elfNN_vms_close_and_cleanup (bfd *abfd)
 #include "elfNN-target.h"
 
 /* VMS-specific vectors.  */
+#if defined (HAVE_bfd_elf64_ia64_vms_vec) || defined (HAVE_all_vecs)
 
 #undef  TARGET_LITTLE_SYM
 #define TARGET_LITTLE_SYM		bfd_elfNN_ia64_vms_vec
@@ -6160,4 +6164,34 @@ elfNN_vms_close_and_cleanup (bfd *abfd)
 #undef  elfNN_bed
 #define elfNN_bed elfNN_ia64_vms_bed
 
+/* Use VMS-style archives.  */
+
+#undef bfd_elfNN_archive_p
+#define bfd_elfNN_archive_p _bfd_vms_lib_ia64_archive_p
+
+#define bfd_elfNN_archive_slurp_armap \
+  _bfd_vms_lib_slurp_armap
+#define bfd_elfNN_archive_slurp_extended_name_table \
+  _bfd_vms_lib_slurp_extended_name_table
+#define bfd_elfNN_archive_construct_extended_name_table \
+  _bfd_vms_lib_construct_extended_name_table
+#define bfd_elfNN_archive_truncate_arname \
+  _bfd_vms_lib_truncate_arname
+#define bfd_elfNN_archive_write_armap \
+  _bfd_vms_lib_write_armap
+#define bfd_elfNN_archive_read_ar_hdr \
+  _bfd_vms_lib_read_ar_hdr
+#define bfd_elfNN_archive_write_ar_hdr \
+  _bfd_vms_lib_write_ar_hdr
+#define bfd_elfNN_archive_openr_next_archived_file \
+  _bfd_vms_lib_openr_next_archived_file
+#define bfd_elfNN_archive_get_elt_at_index \
+  _bfd_vms_lib_get_elt_at_index
+#define bfd_elfNN_archive_generic_stat_arch_elt \
+  _bfd_vms_lib_generic_stat_arch_elt
+#define bfd_elfNN_archive_update_armap_timestamp \
+  _bfd_vms_lib_update_armap_timestamp
+
 #include "elfNN-target.h"
+
+#endif /* !(defined (HAVE_bfd_elf64_ia64_vms_vec) || defined (HAVE_all_vecs)) */
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 89d0df6..5e636a3 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -375,6 +375,7 @@ extern int _bfd_vms_lib_generic_stat_arch_elt (bfd *, struct stat *);
 extern symindex _bfd_vms_lib_find_symbol (bfd *, const char *);
 extern bfd *_bfd_vms_lib_get_imagelib_file (bfd *);
 extern const bfd_target *_bfd_vms_lib_alpha_archive_p (bfd *abfd);
+extern const bfd_target *_bfd_vms_lib_ia64_archive_p (bfd *abfd);
 extern bfd_boolean _bfd_vms_lib_mkarchive (bfd *abfd);
 
 /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c
index 0b45a13..3877686 100644
--- a/bfd/vms-lib.c
+++ b/bfd/vms-lib.c
@@ -619,6 +619,14 @@ _bfd_vms_lib_alpha_archive_p (bfd *abfd)
   return _bfd_vms_lib_archive_p (abfd, vms_lib_alpha);
 }
 
+/* Standard function for ia64 libraries.  */
+
+const bfd_target *
+_bfd_vms_lib_ia64_archive_p (bfd *abfd)
+{
+  return _bfd_vms_lib_archive_p (abfd, vms_lib_ia64);
+}
+
 /* Standard function for text libraries.  */
 
 static const bfd_target *



More information about the Binutils mailing list