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.
This commit is contained in:
Tristan Gingold 2010-01-26 13:42:26 +00:00
parent 98da7939e1
commit 8f95b6e449
17 changed files with 274 additions and 25 deletions

View File

@ -1,3 +1,61 @@
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> 2010-01-26 Alan Modra <amodra@gmail.com>
H.J. Lu <hongjiu.lu@intel.com> H.J. Lu <hongjiu.lu@intel.com>

View File

@ -380,6 +380,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_read_ar_hdr #ifndef MY_read_ar_hdr
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr #define MY_read_ar_hdr _bfd_generic_read_ar_hdr
#endif #endif
#ifndef MY_write_ar_hdr
#define MY_write_ar_hdr _bfd_generic_write_ar_hdr
#endif
#ifndef MY_truncate_arname #ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname #define MY_truncate_arname bfd_bsd_truncate_arname
#endif #endif

View File

@ -837,6 +837,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
#ifndef MY_read_ar_hdr #ifndef MY_read_ar_hdr
#define MY_read_ar_hdr _bfd_generic_read_ar_hdr #define MY_read_ar_hdr _bfd_generic_read_ar_hdr
#endif #endif
#ifndef MY_write_ar_hdr
#define MY_write_ar_hdr _bfd_generic_write_ar_hdr
#endif
#ifndef MY_truncate_arname #ifndef MY_truncate_arname
#define MY_truncate_arname bfd_bsd_truncate_arname #define MY_truncate_arname bfd_bsd_truncate_arname
#endif #endif

View File

@ -104,7 +104,6 @@ SUBSECTION
BSD 4.4 uses a third scheme: It writes a long filename BSD 4.4 uses a third scheme: It writes a long filename
directly after the header. This allows 'ar q' to work. 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: /* Summary of archive member names:
@ -125,7 +124,6 @@ SUBSECTION
"/18 " - SVR4 style, name at offset 18 in name table. "/18 " - SVR4 style, name at offset 18 in name table.
"#1/23 " - Long name (or embedded spaces) 23 characters long, "#1/23 " - Long name (or embedded spaces) 23 characters long,
BSD 4.4 style, full name follows header. BSD 4.4 style, full name follows header.
Implemented for reading, not writing.
" 18 " - Long name 18 characters long, extended pseudo-BSD. " 18 " - Long name 18 characters long, extended pseudo-BSD.
*/ */
@ -159,6 +157,11 @@ struct ar_cache {
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data)) #define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
#define arch_hdr(bfd) ((struct ar_hdr *) arch_eltdata (bfd)->arch_header) #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]))
void void
_bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val) _bfd_ar_spacepad (char *p, size_t n, const char *fmt, long val)
@ -415,6 +418,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr); bfd_size_type allocsize = sizeof (struct areltdata) + sizeof (struct ar_hdr);
char *allocptr = 0; char *allocptr = 0;
file_ptr origin = 0; file_ptr origin = 0;
unsigned int extra_size = 0;
if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr)) if (bfd_bread (hdrp, sizeof (struct ar_hdr), abfd) != sizeof (struct ar_hdr))
{ {
@ -450,17 +454,14 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
if (filename == NULL) if (filename == NULL)
return NULL; return NULL;
} }
/* BSD4.4-style long filename. /* BSD4.4-style long filename. */
Only implemented for reading, so far! */ else if (is_bsd44_extended_name (hdr.ar_name))
else if (hdr.ar_name[0] == '#'
&& hdr.ar_name[1] == '1'
&& hdr.ar_name[2] == '/'
&& ISDIGIT (hdr.ar_name[3]))
{ {
/* BSD-4.4 extended name */ /* BSD-4.4 extended name */
namelen = atoi (&hdr.ar_name[3]); namelen = atoi (&hdr.ar_name[3]);
allocsize += namelen + 1; allocsize += namelen + 1;
parsed_size -= namelen; parsed_size -= namelen;
extra_size = namelen;
allocptr = (char *) bfd_zalloc (abfd, allocsize); allocptr = (char *) bfd_zalloc (abfd, allocsize);
if (allocptr == NULL) if (allocptr == NULL)
@ -515,6 +516,7 @@ _bfd_generic_read_ar_hdr_mag (bfd *abfd, const char *mag)
ared->arch_header = allocptr + sizeof (struct areltdata); ared->arch_header = allocptr + sizeof (struct areltdata);
memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr)); memcpy (ared->arch_header, &hdr, sizeof (struct ar_hdr));
ared->parsed_size = parsed_size; ared->parsed_size = parsed_size;
ared->extra_size = extra_size;
ared->origin = origin; ared->origin = origin;
if (filename != NULL) if (filename != NULL)
@ -1069,7 +1071,8 @@ bfd_slurp_armap (bfd *abfd)
return FALSE; return FALSE;
if (bfd_seek (abfd, (file_ptr) -(sizeof (hdr) + 20), SEEK_CUR) != 0) if (bfd_seek (abfd, (file_ptr) -(sizeof (hdr) + 20), SEEK_CUR) != 0)
return FALSE; 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 do_slurp_bsd_armap (abfd);
} }
@ -1599,6 +1602,103 @@ _bfd_construct_extended_name_table (bfd *abfd,
return TRUE; 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;
}
/* 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;
}
/* A couple of functions for creating ar_hdrs. */ /* A couple of functions for creating ar_hdrs. */
@ -1957,11 +2057,9 @@ _bfd_write_archive_contents (bfd *arch)
{ {
char buffer[DEFAULT_BUFFERSIZE]; char buffer[DEFAULT_BUFFERSIZE];
unsigned int remaining = arelt_size (current); unsigned int remaining = arelt_size (current);
struct ar_hdr *hdr = arch_hdr (current);
/* Write ar header. */ /* Write ar header. */
if (bfd_bwrite (hdr, sizeof (*hdr), arch) if (!_bfd_write_ar_hdr (arch, current))
!= sizeof (*hdr))
return FALSE; return FALSE;
if (bfd_is_thin_archive (arch)) if (bfd_is_thin_archive (arch))
continue; continue;
@ -2235,7 +2333,10 @@ bsd_write_armap (bfd *arch,
{ {
do 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; firstreal += firstreal % 2;
current = current->archive_next; current = current->archive_next;
} }

View File

@ -5524,6 +5524,7 @@ typedef struct bfd_target
NAME##_truncate_arname, \ NAME##_truncate_arname, \
NAME##_write_armap, \ NAME##_write_armap, \
NAME##_read_ar_hdr, \ NAME##_read_ar_hdr, \
NAME##_write_ar_hdr, \
NAME##_openr_next_archived_file, \ NAME##_openr_next_archived_file, \
NAME##_get_elt_at_index, \ NAME##_get_elt_at_index, \
NAME##_generic_stat_arch_elt, \ NAME##_generic_stat_arch_elt, \
@ -5537,6 +5538,7 @@ typedef struct bfd_target
bfd_boolean (*write_armap) bfd_boolean (*write_armap)
(bfd *, unsigned int, struct orl *, unsigned int, int); (bfd *, unsigned int, struct orl *, unsigned int, int);
void * (*_bfd_read_ar_hdr_fn) (bfd *); void * (*_bfd_read_ar_hdr_fn) (bfd *);
bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
bfd * (*openr_next_archived_file) (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)) #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 * (*_bfd_get_elt_at_index) (bfd *, symindex);

View File

@ -2065,6 +2065,7 @@ alpha_adjust_headers (abfd, fhdr, ahdr)
_bfd_ecoff_construct_extended_name_table _bfd_ecoff_construct_extended_name_table
#define alpha_ecoff_truncate_arname _bfd_ecoff_truncate_arname #define alpha_ecoff_truncate_arname _bfd_ecoff_truncate_arname
#define alpha_ecoff_write_armap _bfd_ecoff_write_armap #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_generic_stat_arch_elt _bfd_ecoff_generic_stat_arch_elt
#define alpha_ecoff_update_armap_timestamp _bfd_ecoff_update_armap_timestamp #define alpha_ecoff_update_armap_timestamp _bfd_ecoff_update_armap_timestamp

View File

@ -4193,6 +4193,7 @@ const bfd_target rs6000coff_vec =
bfd_dont_truncate_arname, bfd_dont_truncate_arname,
_bfd_xcoff_write_armap, _bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr, _bfd_xcoff_read_ar_hdr,
_bfd_generic_write_ar_hdr,
_bfd_xcoff_openr_next_archived_file, _bfd_xcoff_openr_next_archived_file,
_bfd_generic_get_elt_at_index, _bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt, _bfd_xcoff_stat_arch_elt,
@ -4447,6 +4448,7 @@ const bfd_target pmac_xcoff_vec =
bfd_dont_truncate_arname, bfd_dont_truncate_arname,
_bfd_xcoff_write_armap, _bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr, _bfd_xcoff_read_ar_hdr,
_bfd_generic_write_ar_hdr,
_bfd_xcoff_openr_next_archived_file, _bfd_xcoff_openr_next_archived_file,
_bfd_generic_get_elt_at_index, _bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt, _bfd_xcoff_stat_arch_elt,

View File

@ -2763,6 +2763,7 @@ const bfd_target rs6000coff64_vec =
bfd_dont_truncate_arname, bfd_dont_truncate_arname,
_bfd_xcoff_write_armap, _bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr, _bfd_xcoff_read_ar_hdr,
_bfd_generic_write_ar_hdr,
xcoff64_openr_next_archived_file, xcoff64_openr_next_archived_file,
_bfd_generic_get_elt_at_index, _bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt, _bfd_xcoff_stat_arch_elt,
@ -3018,6 +3019,7 @@ const bfd_target aix5coff64_vec =
bfd_dont_truncate_arname, bfd_dont_truncate_arname,
_bfd_xcoff_write_armap, _bfd_xcoff_write_armap,
_bfd_xcoff_read_ar_hdr, _bfd_xcoff_read_ar_hdr,
_bfd_generic_write_ar_hdr,
xcoff64_openr_next_archived_file, xcoff64_openr_next_archived_file,
_bfd_generic_get_elt_at_index, _bfd_generic_get_elt_at_index,
_bfd_xcoff_stat_arch_elt, _bfd_xcoff_stat_arch_elt,

View File

@ -3313,6 +3313,7 @@ extern bfd_boolean bfd_elf64_archive_write_armap
#define bfd_elf64_archive_truncate_arname \ #define bfd_elf64_archive_truncate_arname \
_bfd_archive_coff_truncate_arname _bfd_archive_coff_truncate_arname
#define bfd_elf64_archive_read_ar_hdr _bfd_archive_coff_read_ar_hdr #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 \ #define bfd_elf64_archive_openr_next_archived_file \
_bfd_archive_coff_openr_next_archived_file _bfd_archive_coff_openr_next_archived_file
#define bfd_elf64_archive_get_elt_at_index \ #define bfd_elf64_archive_get_elt_at_index \

View File

@ -3743,6 +3743,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
(bfd *, unsigned int, struct orl *, unsigned int, int)) \ (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_true) bfd_true)
#define ieee_read_ar_hdr bfd_nullvoidptr #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_update_armap_timestamp bfd_true
#define ieee_get_elt_at_index _bfd_generic_get_elt_at_index #define ieee_get_elt_at_index _bfd_generic_get_elt_at_index

View File

@ -90,6 +90,7 @@ struct artdata {
struct areltdata { struct areltdata {
char * arch_header; /* it's actually a string */ char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */ 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 */ char *filename; /* null-terminated */
file_ptr origin; /* for element of a thin archive */ file_ptr origin; /* for element of a thin archive */
}; };
@ -207,6 +208,12 @@ extern void _bfd_ar_spacepad
extern void *_bfd_generic_read_ar_hdr_mag extern void *_bfd_generic_read_ar_hdr_mag
(bfd *, const char *); (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 * bfd_generic_openr_next_archived_file
(bfd *archive, bfd *last_file); (bfd *archive, bfd *last_file);
@ -215,6 +222,8 @@ int bfd_generic_stat_arch_elt
#define _bfd_read_ar_hdr(abfd) \ #define _bfd_read_ar_hdr(abfd) \
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (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))
/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
@ -273,6 +282,8 @@ extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \ ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_false) bfd_false)
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr #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 \ #define _bfd_noarchive_openr_next_archived_file \
((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr) ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index \ #define _bfd_noarchive_get_elt_at_index \
@ -291,6 +302,7 @@ extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap bsd_write_armap #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_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 \ #define _bfd_archive_bsd_openr_next_archived_file \
bfd_generic_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_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
@ -310,6 +322,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap coff_write_armap #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_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 \ #define _bfd_archive_coff_openr_next_archived_file \
bfd_generic_openr_next_archived_file bfd_generic_openr_next_archived_file
#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
@ -317,6 +330,26 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
bfd_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp bfd_true #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 /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */

View File

@ -95,6 +95,7 @@ struct artdata {
struct areltdata { struct areltdata {
char * arch_header; /* it's actually a string */ char * arch_header; /* it's actually a string */
unsigned int parsed_size; /* octets of filesize not including ar_hdr */ 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 */ char *filename; /* null-terminated */
file_ptr origin; /* for element of a thin archive */ file_ptr origin; /* for element of a thin archive */
}; };
@ -212,6 +213,12 @@ extern void _bfd_ar_spacepad
extern void *_bfd_generic_read_ar_hdr_mag extern void *_bfd_generic_read_ar_hdr_mag
(bfd *, const char *); (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 * bfd_generic_openr_next_archived_file
(bfd *archive, bfd *last_file); (bfd *archive, bfd *last_file);
@ -220,6 +227,8 @@ int bfd_generic_stat_arch_elt
#define _bfd_read_ar_hdr(abfd) \ #define _bfd_read_ar_hdr(abfd) \
BFD_SEND (abfd, _bfd_read_ar_hdr_fn, (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))
/* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use
BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ BFD_JUMP_TABLE_GENERIC (_bfd_generic). */
@ -278,6 +287,8 @@ extern bfd_boolean _bfd_nocore_core_file_matches_executable_p
((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \ ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) \
bfd_false) bfd_false)
#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr #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 \ #define _bfd_noarchive_openr_next_archived_file \
((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr) ((bfd *(*) (bfd *, bfd *)) bfd_nullvoidptr)
#define _bfd_noarchive_get_elt_at_index \ #define _bfd_noarchive_get_elt_at_index \
@ -296,6 +307,7 @@ extern bfd_boolean _bfd_archive_bsd_construct_extended_name_table
#define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname #define _bfd_archive_bsd_truncate_arname bfd_bsd_truncate_arname
#define _bfd_archive_bsd_write_armap bsd_write_armap #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_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 \ #define _bfd_archive_bsd_openr_next_archived_file \
bfd_generic_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_bsd_get_elt_at_index _bfd_generic_get_elt_at_index
@ -315,6 +327,7 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
#define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname #define _bfd_archive_coff_truncate_arname bfd_dont_truncate_arname
#define _bfd_archive_coff_write_armap coff_write_armap #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_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 \ #define _bfd_archive_coff_openr_next_archived_file \
bfd_generic_openr_next_archived_file bfd_generic_openr_next_archived_file
#define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index #define _bfd_archive_coff_get_elt_at_index _bfd_generic_get_elt_at_index
@ -322,6 +335,26 @@ extern bfd_boolean _bfd_archive_coff_construct_extended_name_table
bfd_generic_stat_arch_elt bfd_generic_stat_arch_elt
#define _bfd_archive_coff_update_armap_timestamp bfd_true #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 /* Routines to use for BFD_JUMP_TABLE_SYMBOLS where there is no symbol
support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */ support. Use BFD_JUMP_TABLE_SYMBOLS (_bfd_nosymbols). */

View File

@ -270,6 +270,7 @@ extern bfd_boolean _bfd_ecoff_slurp_armap (bfd *);
extern bfd_boolean _bfd_ecoff_write_armap extern bfd_boolean _bfd_ecoff_write_armap
(bfd *, unsigned int, struct orl *, unsigned int, int); (bfd *, unsigned int, struct orl *, unsigned int, int);
#define _bfd_ecoff_read_ar_hdr _bfd_generic_read_ar_hdr #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 \ #define _bfd_ecoff_openr_next_archived_file \
bfd_generic_openr_next_archived_file bfd_generic_openr_next_archived_file
#define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index #define _bfd_ecoff_get_elt_at_index _bfd_generic_get_elt_at_index

View File

@ -25,16 +25,6 @@
#ifndef MACH_O_TARGET_COMMON_DEFINED #ifndef MACH_O_TARGET_COMMON_DEFINED
#define 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_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_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
#define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook #define bfd_mach_o_new_section_hook _bfd_generic_new_section_hook
@ -176,7 +166,7 @@ const bfd_target TARGET_NAME =
#if TARGET_ARCHIVE #if TARGET_ARCHIVE
BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o), BFD_JUMP_TABLE_ARCHIVE (bfd_mach_o),
#else #else
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd), BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_bsd44),
#endif #endif
BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o), BFD_JUMP_TABLE_SYMBOLS (bfd_mach_o),
BFD_JUMP_TABLE_RELOCS (bfd_mach_o), BFD_JUMP_TABLE_RELOCS (bfd_mach_o),

View File

@ -4020,6 +4020,21 @@ bfd_mach_o_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
#undef TARGET_BIG_ENDIAN #undef TARGET_BIG_ENDIAN
#undef TARGET_ARCHIVE #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_NAME mach_o_fat_vec
#define TARGET_STRING "mach-o-fat" #define TARGET_STRING "mach-o-fat"
#define TARGET_ARCHITECTURE bfd_arch_unknown #define TARGET_ARCHITECTURE bfd_arch_unknown

View File

@ -1179,6 +1179,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define oasys_truncate_arname bfd_dont_truncate_arname #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_write_armap ((bfd_boolean (*) (bfd *, unsigned int, struct orl *, unsigned int, int)) bfd_true)
#define oasys_read_ar_hdr bfd_nullvoidptr #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_get_elt_at_index _bfd_generic_get_elt_at_index
#define oasys_update_armap_timestamp bfd_true #define oasys_update_armap_timestamp bfd_true
#define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name #define oasys_bfd_is_local_label_name bfd_generic_is_local_label_name

View File

@ -328,6 +328,7 @@ BFD_JUMP_TABLE macros.
. NAME##_truncate_arname, \ . NAME##_truncate_arname, \
. NAME##_write_armap, \ . NAME##_write_armap, \
. NAME##_read_ar_hdr, \ . NAME##_read_ar_hdr, \
. NAME##_write_ar_hdr, \
. NAME##_openr_next_archived_file, \ . NAME##_openr_next_archived_file, \
. NAME##_get_elt_at_index, \ . NAME##_get_elt_at_index, \
. NAME##_generic_stat_arch_elt, \ . NAME##_generic_stat_arch_elt, \
@ -341,6 +342,7 @@ BFD_JUMP_TABLE macros.
. bfd_boolean (*write_armap) . bfd_boolean (*write_armap)
. (bfd *, unsigned int, struct orl *, unsigned int, int); . (bfd *, unsigned int, struct orl *, unsigned int, int);
. void * (*_bfd_read_ar_hdr_fn) (bfd *); . void * (*_bfd_read_ar_hdr_fn) (bfd *);
. bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
. bfd * (*openr_next_archived_file) (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)) .#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 * (*_bfd_get_elt_at_index) (bfd *, symindex);