* targets.c (BFD_JUMP_TABLE_ARCHIVE): Add initializer for write_ar_hdr.
(bfd_target): Add _bfd_write_ar_hdr_fn field.
* archive.c (is_bsd44_extended_name): New macro.
(_bfd_generic_read_ar_hdr_mag): Use it. Add extra_size.
(bfd_slurp_armap): Also check for "__.SYMDEF" as a BSD4.4 extended
name.
(_bfd_archive_bsd44_construct_extended_name_table): New function.
(_bfd_generic_write_ar_hdr): Ditto.
(_bfd_bsd44_write_ar_hdr): Ditto.
(_bfd_write_archive_contents): Call _bfd_write_ar_hdr.
(bsd_write_armap): Adjust firstreal computation.
* libbfd-in.h (struct areltdata): Add extra_size field.
(_bfd_generic_write_ar_hdr): Add prototype.
(_bfd_bsd44_write_ar_hdr): Ditto.
(_bfd_write_ar_hdr): Define.
(_bfd_noarchive_write_ar_hdr): Ditto.
(_bfd_archive_bsd_write_ar_hdr): Ditto.
(_bfd_archive_coff_write_ar_hdr): Ditto.
(_bfd_archive_bsd44_slurp_armap): Ditto.
(_bfd_archive_bsd44_slurp_extended_name_table): Ditto.
(_bfd_archive_bsd44_construct_extended_name_table): New prototype.
(_bfd_archive_bsd44_truncate_arname): Ditto.
(_bfd_archive_bsd44_write_armap): Ditto.
(_bfd_archive_bsd44_read_ar_hdr): Ditto.
(_bfd_archive_bsd44_write_ar_hdr): Ditto.
(_bfd_archive_bsd44_openr_next_archived_file): Ditto.
(_bfd_archive_bsd44_get_elt_at_index): Ditto.
(_bfd_archive_bsd44_generic_stat_arch_elt): Ditto.
(_bfd_archive_bsd44_update_armap_timestamp): Ditto.
* libbfd.h: Regenerate.
* oasys.c (oasys_write_ar_hdr): Define.
* libecoff.h (_bfd_ecoff_write_ar_hdr): Define.
* ieee.c (ieee_write_ar_hdr): Define.
* elf64-mips.c (bfd_elf64_archive_write_ar_hdr): Define.
* coff-rs6000.c (rs6000coff_vec): Adjust for write_ar_hdr field.
(bfd_pmac_xcoff_backend_data): Ditto.
* coff64-rs6000.c (rs6000coff64_vec): Ditto.
(bfd_xcoff_aix5_backend_data): Ditto.
* coff-alpha.c (alpha_ecoff_write_ar_hdr): Define.
* aout-target.h (MY_write_ar_hdr): Define it if not defined.
* aout-tic30.c (MY_write_ar_hdr): Ditto.
* mach-o-target.c (TARGET_NAME): Use _bfd_archive_bsd44 archive.
(bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr)
(bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table)
(bfd_mach_o_construct_extended_name_table)
(bfd_mach_o_truncate_arname, bfd_mach_o_write_armap)
(bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt)
(bfd_mach_o_update_armap_timestamp): Moved to mach-o.c
* mach-o.c (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr)
(bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table)
(bfd_mach_o_construct_extended_name_table)
(bfd_mach_o_truncate_arname, bfd_mach_o_write_armap)
(bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt)
(bfd_mach_o_update_armap_timestamp): Moved from mach-o-target.c
* bfd-in2.h: Regenerate.
+2010-01-26 Tristan Gingold <gingold@adacore.com>
+
+ * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add initializer for write_ar_hdr.
+ (bfd_target): Add _bfd_write_ar_hdr_fn field.
+ * archive.c (is_bsd44_extended_name): New macro.
+ (_bfd_generic_read_ar_hdr_mag): Use it. Add extra_size.
+ (bfd_slurp_armap): Also check for "__.SYMDEF" as a BSD4.4 extended
+ name.
+ (_bfd_archive_bsd44_construct_extended_name_table): New function.
+ (_bfd_generic_write_ar_hdr): Ditto.
+ (_bfd_bsd44_write_ar_hdr): Ditto.
+ (_bfd_write_archive_contents): Call _bfd_write_ar_hdr.
+ (bsd_write_armap): Adjust firstreal computation.
+ * libbfd-in.h (struct areltdata): Add extra_size field.
+ (_bfd_generic_write_ar_hdr): Add prototype.
+ (_bfd_bsd44_write_ar_hdr): Ditto.
+ (_bfd_write_ar_hdr): Define.
+ (_bfd_noarchive_write_ar_hdr): Ditto.
+ (_bfd_archive_bsd_write_ar_hdr): Ditto.
+ (_bfd_archive_coff_write_ar_hdr): Ditto.
+ (_bfd_archive_bsd44_slurp_armap): Ditto.
+ (_bfd_archive_bsd44_slurp_extended_name_table): Ditto.
+ (_bfd_archive_bsd44_construct_extended_name_table): New prototype.
+ (_bfd_archive_bsd44_truncate_arname): Ditto.
+ (_bfd_archive_bsd44_write_armap): Ditto.
+ (_bfd_archive_bsd44_read_ar_hdr): Ditto.
+ (_bfd_archive_bsd44_write_ar_hdr): Ditto.
+ (_bfd_archive_bsd44_openr_next_archived_file): Ditto.
+ (_bfd_archive_bsd44_get_elt_at_index): Ditto.
+ (_bfd_archive_bsd44_generic_stat_arch_elt): Ditto.
+ (_bfd_archive_bsd44_update_armap_timestamp): Ditto.
+ * libbfd.h: Regenerate.
+ * oasys.c (oasys_write_ar_hdr): Define.
+ * libecoff.h (_bfd_ecoff_write_ar_hdr): Define.
+ * ieee.c (ieee_write_ar_hdr): Define.
+ * elf64-mips.c (bfd_elf64_archive_write_ar_hdr): Define.
+ * coff-rs6000.c (rs6000coff_vec): Adjust for write_ar_hdr field.
+ (bfd_pmac_xcoff_backend_data): Ditto.
+ * coff64-rs6000.c (rs6000coff64_vec): Ditto.
+ (bfd_xcoff_aix5_backend_data): Ditto.
+ * coff-alpha.c (alpha_ecoff_write_ar_hdr): Define.
+ * aout-target.h (MY_write_ar_hdr): Define it if not defined.
+ * aout-tic30.c (MY_write_ar_hdr): Ditto.
+ * mach-o-target.c (TARGET_NAME): Use _bfd_archive_bsd44 archive.
+ (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr)
+ (bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table)
+ (bfd_mach_o_construct_extended_name_table)
+ (bfd_mach_o_truncate_arname, bfd_mach_o_write_armap)
+ (bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt)
+ (bfd_mach_o_update_armap_timestamp): Moved to mach-o.c
+ * mach-o.c (bfd_mach_o_mkarchive, bfd_mach_o_read_ar_hdr)
+ (bfd_mach_o_slurp_armap, bfd_mach_o_slurp_extended_name_table)
+ (bfd_mach_o_construct_extended_name_table)
+ (bfd_mach_o_truncate_arname, bfd_mach_o_write_armap)
+ (bfd_mach_o_get_elt_at_index, bfd_mach_o_generic_stat_arch_elt)
+ (bfd_mach_o_update_armap_timestamp): Moved from mach-o-target.c
+ * bfd-in2.h: Regenerate.
+
2010-01-26 Alan Modra <amodra@gmail.com>
H.J. Lu <hongjiu.lu@intel.com>
#ifndef MY_read_ar_hdr
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
#endif
+#ifndef MY_write_ar_hdr
+#define MY_write_ar_hdr _bfd_generic_write_ar_hdr
+#endif
#ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname
#endif
#ifndef MY_read_ar_hdr
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr
#endif
+#ifndef MY_write_ar_hdr
+#define MY_write_ar_hdr _bfd_generic_write_ar_hdr
+#endif
#ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname
#endif
BSD 4.4 uses a third scheme: It writes a long filename
directly after the header. This allows 'ar q' to work.
- We currently can read BSD 4.4 archives, but not write them.
*/
/* Summary of archive member names:
"/18 " - SVR4 style, name at offset 18 in name table.
"#1/23 " - Long name (or embedded spaces) 23 characters long,
BSD 4.4 style, full name follows header.
- Implemented for reading, not writing.
" 18 " - Long name 18 characters long, extended pseudo-BSD.
*/
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata (bfd)->arch_header)
+
+/* True iff NAME designated a BSD 4.4 extended name. */
+
+#define is_bsd44_extended_name(NAME) \
+ (NAME[0] == '#' && NAME[1] == '1' && NAME[2] == '/' && ISDIGIT (NAME[3]))
\f
void
_bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
char *allocptr = 0;
file_ptr origin = 0;
+ unsigned int extra_size = 0;
if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
{
if (filename == NULL)
return NULL;
}
- /* BSD4.4-style long filename.
- Only implemented for reading, so far! */
- else if (hdr.ar_name[0] == '#'
- && hdr.ar_name[1] == '1'
- && hdr.ar_name[2] == '/'
- && ISDIGIT (hdr.ar_name[3]))
+ /* BSD4.4-style long filename. */
+ else if (is_bsd44_extended_name (hdr.ar_name))
{
/* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]);
allocsize += namelen + 1;
parsed_size -= namelen;
+ extra_size = namelen;
allocptr = (char *) bfd_zalloc (abfd, allocsize);
if (allocptr == NULL)
ared->arch_header = allocptr + sizeof (struct areltdata);
memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));
ared->parsed_size = parsed_size;
+ ared->extra_size = extra_size;
ared->origin = origin;
if (filename != NULL)
return FALSE;
if (bfd_seek (abfd, (file_ptr) -(sizeof (hdr) + 20), SEEK_CUR) != 0)
return FALSE;
- if (CONST_STRNEQ (extname, "__.SYMDEF SORTED"))
+ if (CONST_STRNEQ (extname, "__.SYMDEF SORTED")
+ || CONST_STRNEQ (extname, "__.SYMDEF"))
return do_slurp_bsd_armap (abfd);
}
return TRUE;
}
+
+/* Do not construct an extended name table but transforms name field into
+ its extended form. */
+
+bfd_boolean
+_bfd_archive_bsd44_construct_extended_name_table (bfd *abfd,
+ char **tabloc,
+ bfd_size_type *tablen,
+ const char **name)
+{
+ unsigned int maxname = abfd->xvec->ar_max_namelen;
+ bfd *current;
+
+ *tablen = 0;
+ *tabloc = NULL;
+ *name = NULL;
+
+ for (current = abfd->archive_head;
+ current != NULL;
+ current = current->archive_next)
+ {
+ const char *normal = normalize (current, current->filename);
+ int has_space = 0;
+ unsigned int len;
+
+ if (normal == NULL)
+ return FALSE;
+
+ for (len = 0; normal[len]; len++)
+ if (normal[len] == ' ')
+ has_space = 1;
+
+ if (len > maxname || has_space)
+ {
+ struct ar_hdr *hdr = arch_hdr (current);
+
+ len = (len + 3) & ~3;
+ arch_eltdata (current)->extra_size = len;
+ _bfd_ar_spacepad (hdr->ar_name, maxname, "#1/%u", len);
+ }
+ }
+
+ return TRUE;
+}
+\f
+/* Write an archive header. */
+
+bfd_boolean
+_bfd_generic_write_ar_hdr (bfd *archive, bfd *abfd)
+{
+ struct ar_hdr *hdr = arch_hdr (abfd);
+
+ if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+ return FALSE;
+ return TRUE;
+}
+
+/* Write an archive header using BSD4.4 convention. */
+
+bfd_boolean
+_bfd_bsd44_write_ar_hdr (bfd *archive, bfd *abfd)
+{
+ struct ar_hdr *hdr = arch_hdr (abfd);
+
+ if (is_bsd44_extended_name (hdr->ar_name))
+ {
+ /* This is a BSD 4.4 extended name. */
+ const char *fullname = normalize (abfd, abfd->filename);
+ unsigned int len = strlen (fullname);
+ unsigned int padded_len = (len + 3) & ~3;
+
+ BFD_ASSERT (padded_len == arch_eltdata (abfd)->extra_size);
+
+ _bfd_ar_spacepad (hdr->ar_size, sizeof (hdr->ar_size), "%-10ld",
+ arch_eltdata (abfd)->parsed_size + padded_len);
+
+ if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+ return FALSE;
+
+ if (bfd_bwrite (fullname, len, archive) != len)
+ return FALSE;
+ if (len & 3)
+ {
+ static const char pad[3] = { 0, 0, 0 };
+
+ len = 4 - (len & 3);
+ if (bfd_bwrite (pad, len, archive) != len)
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (bfd_bwrite (hdr, sizeof (*hdr), archive) != sizeof (*hdr))
+ return FALSE;
+ }
+ return TRUE;
+}
\f
/* A couple of functions for creating ar_hdrs. */
{
char buffer[DEFAULT_BUFFERSIZE];
unsigned int remaining = arelt_size (current);
- struct ar_hdr *hdr = arch_hdr (current);
/* Write ar header. */
- if (bfd_bwrite (hdr, sizeof (*hdr), arch)
- != sizeof (*hdr))
- return FALSE;
+ if (!_bfd_write_ar_hdr (arch, current))
+ return FALSE;
if (bfd_is_thin_archive (arch))
continue;
if (bfd_seek (current, (file_ptr) 0, SEEK_SET) != 0)
{
do
{
- firstreal += arelt_size (current) + sizeof (struct ar_hdr);
+ struct areltdata *ared = arch_eltdata (current);
+
+ firstreal += (ared->parsed_size + ared->extra_size
+ + sizeof (struct ar_hdr));
firstreal += firstreal % 2;
current = current->archive_next;
}
NAME##_truncate_arname, \
NAME##_write_armap, \
NAME##_read_ar_hdr, \
+ NAME##_write_ar_hdr, \
NAME##_openr_next_archived_file, \
NAME##_get_elt_at_index, \
NAME##_generic_stat_arch_elt, \
bfd_boolean (*write_armap)
(bfd *, unsigned int, struct orl *, unsigned int, int);
void * (*_bfd_read_ar_hdr_fn) (bfd *);
+ bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
bfd * (*openr_next_archived_file) (bfd *, bfd *);
#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
_bfd_ecoff_construct_extended_name_table
#define alpha_ecoff_truncate_arname _bfd_ecoff_truncate_arname
#define alpha_ecoff_write_armap _bfd_ecoff_write_armap
+#define alpha_ecoff_write_ar_hdr _bfd_generic_write_ar_hdr
#define alpha_ecoff_generic_stat_arch_elt _bfd_ecoff_generic_stat_arch_elt
#define alpha_ecoff_update_armap_timestamp _bfd_ecoff_update_armap_timestamp
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
+ _bfd_generic_write_ar_hdr,
_bfd_xcoff_openr_next_archived_file,
_bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt,
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
+ _bfd_generic_write_ar_hdr,
_bfd_xcoff_openr_next_archived_file,
_bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt,
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
+ _bfd_generic_write_ar_hdr,
xcoff64_openr_next_archived_file,
_bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt,
bfd_dont_truncate_arname,
_bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr,
+ _bfd_generic_write_ar_hdr,
xcoff64_openr_next_archived_file,
_bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt,
#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 *, unsigned int, struct orl *, unsigned int, int)) \
bfd_true)
#define ieee_read_ar_hdr bfd_nullvoidptr
+#define ieee_write_ar_hdr ((bfd_boolean (*) (bfd *, bfd *)) bfd_false)
#define ieee_update_armap_timestamp bfd_true
#define ieee_get_elt_at_index _bfd_generic_get_elt_at_index
struct areltdata {
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
+ unsigned int extra_size; /* BSD4.4: extra bytes after the header. */
char *filename; /* null-terminated */
file_ptr origin; /* for element of a thin archive */
};
extern void *_bfd_generic_read_ar_hdr_mag
(bfd *, const char *);
+extern bfd_boolean _bfd_generic_write_ar_hdr
+ (bfd *, bfd *);
+
+extern bfd_boolean _bfd_bsd44_write_ar_hdr
+ (bfd *, bfd *);
+
bfd * bfd_generic_openr_next_archived_file
(bfd *archive, bfd *last_file);
#define _bfd_read_ar_hdr(abfd) \
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
+#define _bfd_write_ar_hdr(archive, abfd) \
+ BFD_SEND (abfd, _bfd_write_ar_hdr_fn, (archive, abfd))
\f
/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_false)
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
+#define _bfd_noarchive_write_ar_hdr \
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_false)
#define _bfd_noarchive_openr_next_archived_file \
((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index \
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap bsd_write_armap
#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr
#define _bfd_archive_bsd_openr_next_archived_file \
bfd_generic_openr_next_archived_file
#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap coff_write_armap
#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr
#define _bfd_archive_coff_openr_next_archived_file \
bfd_generic_openr_next_archived_file
#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp bfd_true
+/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
+ archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44). */
+
+#define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap
+#define _bfd_archive_bsd44_slurp_extended_name_table \
+ _bfd_slurp_extended_name_table
+extern bfd_boolean _bfd_archive_bsd44_construct_extended_name_table
+ (bfd *, char **, bfd_size_type *, const char **);
+#define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname
+#define _bfd_archive_bsd44_write_armap bsd_write_armap
+#define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr
+#define _bfd_archive_bsd44_openr_next_archived_file \
+ bfd_generic_openr_next_archived_file
+#define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index
+#define _bfd_archive_bsd44_generic_stat_arch_elt \
+ bfd_generic_stat_arch_elt
+#define _bfd_archive_bsd44_update_armap_timestamp \
+ _bfd_archive_bsd_update_armap_timestamp
+
/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
struct areltdata {
char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */
+ unsigned int extra_size; /* BSD4.4: extra bytes after the header. */
char *filename; /* null-terminated */
file_ptr origin; /* for element of a thin archive */
};
extern void *_bfd_generic_read_ar_hdr_mag
(bfd *, const char *);
+extern bfd_boolean _bfd_generic_write_ar_hdr
+ (bfd *, bfd *);
+
+extern bfd_boolean _bfd_bsd44_write_ar_hdr
+ (bfd *, bfd *);
+
bfd * bfd_generic_openr_next_archived_file
(bfd *archive, bfd *last_file);
#define _bfd_read_ar_hdr(abfd) \
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (abfd))
+#define _bfd_write_ar_hdr(archive, abfd) \
+ BFD_SEND (abfd, _bfd_write_ar_hdr_fn, (archive, abfd))
\f
/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_false)
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr
+#define _bfd_noarchive_write_ar_hdr \
+ ((bfd_boolean (*) (bfd *, bfd *)) bfd_false)
#define _bfd_noarchive_openr_next_archived_file \
((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index \
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap bsd_write_armap
#define _bfd_archive_bsd_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_archive_bsd_write_ar_hdr _bfd_generic_write_ar_hdr
#define _bfd_archive_bsd_openr_next_archived_file \
bfd_generic_openr_next_archived_file
#define _bfd_archive_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap coff_write_armap
#define _bfd_archive_coff_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_archive_coff_write_ar_hdr _bfd_generic_write_ar_hdr
#define _bfd_archive_coff_openr_next_archived_file \
bfd_generic_openr_next_archived_file
#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp bfd_true
+/* Routines to use for BFD_JUMP_TABLE_ARCHIVE to get BSD4.4 style
+ archives. Use BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44). */
+
+#define _bfd_archive_bsd44_slurp_armap bfd_slurp_bsd_armap
+#define _bfd_archive_bsd44_slurp_extended_name_table \
+ _bfd_slurp_extended_name_table
+extern bfd_boolean _bfd_archive_bsd44_construct_extended_name_table
+ (bfd *, char **, bfd_size_type *, const char **);
+#define _bfd_archive_bsd44_truncate_arname bfd_bsd_truncate_arname
+#define _bfd_archive_bsd44_write_armap bsd_write_armap
+#define _bfd_archive_bsd44_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_archive_bsd44_write_ar_hdr _bfd_bsd44_write_ar_hdr
+#define _bfd_archive_bsd44_openr_next_archived_file \
+ bfd_generic_openr_next_archived_file
+#define _bfd_archive_bsd44_get_elt_at_index _bfd_generic_get_elt_at_index
+#define _bfd_archive_bsd44_generic_stat_arch_elt \
+ bfd_generic_stat_arch_elt
+#define _bfd_archive_bsd44_update_armap_timestamp \
+ _bfd_archive_bsd_update_armap_timestamp
+
/* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */
extern bfd_boolean _bfd_ecoff_write_armap
(bfd *, unsigned int, struct orl *, unsigned int, int);
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr
+#define _bfd_ecoff_write_ar_hdr _bfd_generic_write_ar_hdr
#define _bfd_ecoff_openr_next_archived_file \
bfd_generic_openr_next_archived_file
#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index
#ifndef MACH_O_TARGET_COMMON_DEFINED
#define MACH_O_TARGET_COMMON_DEFINED
-#define bfd_mach_o_mkarchive _bfd_noarchive_mkarchive
-#define bfd_mach_o_read_ar_hdr _bfd_noarchive_read_ar_hdr
-#define bfd_mach_o_slurp_armap _bfd_noarchive_slurp_armap
-#define bfd_mach_o_slurp_extended_name_table _bfd_noarchive_slurp_extended_name_table
-#define bfd_mach_o_construct_extended_name_table _bfd_noarchive_construct_extended_name_table
-#define bfd_mach_o_truncate_arname _bfd_noarchive_truncate_arname
-#define bfd_mach_o_write_armap _bfd_noarchive_write_armap
-#define bfd_mach_o_get_elt_at_index _bfd_noarchive_get_elt_at_index
-#define bfd_mach_o_generic_stat_arch_elt _bfd_noarchive_generic_stat_arch_elt
-#define bfd_mach_o_update_armap_timestamp _bfd_noarchive_update_armap_timestamp
#define bfd_mach_o_close_and_cleanup _bfd_generic_close_and_cleanup
#define bfd_mach_o_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook
#if TARGET_ARCHIVE
BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
#else
- BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44),
#endif
BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
BFD_JUMP_TABLE_RELOCS (bfd_mach_o),
#undef TARGET_BIG_ENDIAN
#undef TARGET_ARCHIVE
+/* Not yet handled: creating an archive. */
+#define bfd_mach_o_mkarchive _bfd_noarchive_mkarchive
+
+/* Not used. */
+#define bfd_mach_o_read_ar_hdr _bfd_noarchive_read_ar_hdr
+#define bfd_mach_o_write_ar_hdr _bfd_noarchive_write_ar_hdr
+#define bfd_mach_o_slurp_armap _bfd_noarchive_slurp_armap
+#define bfd_mach_o_slurp_extended_name_table _bfd_noarchive_slurp_extended_name_table
+#define bfd_mach_o_construct_extended_name_table _bfd_noarchive_construct_extended_name_table
+#define bfd_mach_o_truncate_arname _bfd_noarchive_truncate_arname
+#define bfd_mach_o_write_armap _bfd_noarchive_write_armap
+#define bfd_mach_o_get_elt_at_index _bfd_noarchive_get_elt_at_index
+#define bfd_mach_o_generic_stat_arch_elt _bfd_noarchive_generic_stat_arch_elt
+#define bfd_mach_o_update_armap_timestamp _bfd_noarchive_update_armap_timestamp
+
#define TARGET_NAME mach_o_fat_vec
#define TARGET_STRING "mach-o-fat"
#define TARGET_ARCHITECTURE bfd_arch_unknown
#define oasys_truncate_arname bfd_dont_truncate_arname
#define oasys_write_armap ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) bfd_true)
#define oasys_read_ar_hdr bfd_nullvoidptr
+#define oasys_write_ar_hdr ((bfd_boolean (*) (bfd *, bfd *)) bfd_false)
#define oasys_get_elt_at_index _bfd_generic_get_elt_at_index
#define oasys_update_armap_timestamp bfd_true
#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name
. NAME##_truncate_arname, \
. NAME##_write_armap, \
. NAME##_read_ar_hdr, \
+. NAME##_write_ar_hdr, \
. NAME##_openr_next_archived_file, \
. NAME##_get_elt_at_index, \
. NAME##_generic_stat_arch_elt, \
. bfd_boolean (*write_armap)
. (bfd *, unsigned int, struct orl *, unsigned int, int);
. void * (*_bfd_read_ar_hdr_fn) (bfd *);
+. bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
. bfd * (*openr_next_archived_file) (bfd *, bfd *);
.#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
. bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);