diff options
-rw-r--r-- | bfd/ChangeLog | 31 | ||||
-rw-r--r-- | bfd/archive.c | 30 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 7 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 19 | ||||
-rw-r--r-- | bfd/libbfd.h | 11 | ||||
-rw-r--r-- | bfd/targets.c | 7 |
6 files changed, 82 insertions, 23 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 07f9c75..6fe55d3 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,34 @@ +Fri Oct 6 12:04:02 1995 Ian Lance Taylor <ian@cygnus.com> + + * coff-rs6000.c: Add full support for AIX archives. Rewrite old + read-only/host-only support. + + * coffcode.h (coff_slurp_symbol_table): Set C_HIDEXT symbols to be + BSF_LOCAL. + + * targets.c (bfd_target): Add _bfd_read_ar_hdr field. Modify + BFD_JUMP_TABLE_ARCHIVE accordingly. + * libbfd-in.h (_bfd_snarf_ar_hdr): Don't declare. + (_bfd_compute_and_write_armap): Declare. + (_bfd_generic_read_ar_hdr): Declare. + (_bfd_read_ar_hdr): Define. + (_bfd_noarchive_read_ar_hdr): Define. + (_bfd_archive_bsd_read_ar_hdr): Define. + (_bfd_archive_coff_read_ar_hdr): Define. + * archive.c: Change all callers of _bfd_snarf_ar_hdr to call + _bfd_read_ar_hdr instead. + (_bfd_generic_read_ar_hdr): Rename from _bfd_snarf_ar_hdr. + (_bfd_compute_and_write_armap): Rename from + compute_and_write_armap. Make non-static. Change all callers. + * ecoff.c (_bfd_ecoff_slurp_armap): Call _bfd_read_ar_hdr rather + than _bfd_snarf_ar_hdr. + * aout-target.h (MY_read_ar_hdr): Define if not defined. + * ieee.c (ieee_read_ar_hdr): Define. + * libecoff.h (_bfd_ecoff_read_ar_hdr): Define. + * oasys.c (oasys_read_ar_hdr): Define. + * som.c (som_read_ar_hdr): Define. + * bfd-in2.h, libbfd.h: Rebuild. + Thu Oct 5 14:04:07 1995 steve chamberlain <sac@slash.cygnus.com> * peicode.c (coff_swap_filehdr_in): If symptr is diff --git a/bfd/archive.c b/bfd/archive.c index fbf5bec..28073da 100644 --- a/bfd/archive.c +++ b/bfd/archive.c @@ -178,8 +178,6 @@ static boolean do_slurp_coff_armap PARAMS ((bfd *abfd)); static const char *normalize PARAMS ((bfd *, const char *file)); static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd, const char *)); -static boolean compute_and_write_armap PARAMS ((bfd *arch, - unsigned int elength)); boolean _bfd_generic_mkarchive (abfd) @@ -365,8 +363,8 @@ get_extended_arelt_filename (arch, name) could have been moved arbitrarily. */ -struct areltdata * -_bfd_snarf_ar_hdr (abfd) +PTR +_bfd_generic_read_ar_hdr (abfd) bfd *abfd; { #ifndef errno @@ -496,7 +494,7 @@ _bfd_snarf_ar_hdr (abfd) ared->filename[namelen] = '\0'; } - return ared; + return (PTR) ared; } /* This is an internal function; it's mainly used when indexing @@ -518,7 +516,7 @@ _bfd_get_elt_at_filepos (archive, filepos) if (0 > bfd_seek (archive, filepos, SEEK_SET)) return NULL; - if ((new_areldata = _bfd_snarf_ar_hdr (archive)) == NULL) + if ((new_areldata = _bfd_read_ar_hdr (archive)) == NULL) return NULL; n_nfd = _bfd_create_empty_archive_element_shell (archive); @@ -745,7 +743,7 @@ do_slurp_bsd_armap (abfd) unsigned int parsed_size; carsym *set; - mapdata = _bfd_snarf_ar_hdr (abfd); + mapdata = _bfd_read_ar_hdr (abfd); if (mapdata == NULL) return false; parsed_size = mapdata->parsed_size; @@ -826,7 +824,7 @@ do_slurp_coff_armap (abfd) char int_buf[sizeof (long)]; unsigned int carsym_size, ptrsize, i; - mapdata = _bfd_snarf_ar_hdr (abfd); + mapdata = _bfd_read_ar_hdr (abfd); if (mapdata == NULL) return false; parsed_size = mapdata->parsed_size; @@ -915,7 +913,7 @@ do_slurp_coff_armap (abfd) struct areltdata *tmp; bfd_seek (abfd, ardata->first_file_filepos, SEEK_SET); - tmp = _bfd_snarf_ar_hdr (abfd); + tmp = _bfd_read_ar_hdr (abfd); if (tmp != NULL) { if (tmp->arch_header[0] == '/' @@ -1005,7 +1003,7 @@ bfd_slurp_bsd_armap_f2 (abfd) return true; } - mapdata = _bfd_snarf_ar_hdr (abfd); + mapdata = _bfd_read_ar_hdr (abfd); if (mapdata == NULL) return false; @@ -1106,7 +1104,7 @@ _bfd_slurp_extended_name_table (abfd) return true; } - namedata = _bfd_snarf_ar_hdr (abfd); + namedata = _bfd_read_ar_hdr (abfd); if (namedata == NULL) return false; @@ -1653,7 +1651,7 @@ _bfd_write_archive_contents (arch) if (makemap && hasobjects) { - if (compute_and_write_armap (arch, elength) != true) + if (_bfd_compute_and_write_armap (arch, elength) != true) return false; } @@ -1728,8 +1726,8 @@ _bfd_write_archive_contents (arch) { if (bfd_update_armap_timestamp (arch)) break; - fprintf (stderr, - "Warning: writing archive was slow: rewriting timestamp\n"); + (*_bfd_error_handler) + ("Warning: writing archive was slow: rewriting timestamp\n"); } while (++tries < 6); } @@ -1739,8 +1737,8 @@ _bfd_write_archive_contents (arch) /* Note that the namidx for the first symbol is 0 */ -static boolean -compute_and_write_armap (arch, elength) +boolean +_bfd_compute_and_write_armap (arch, elength) bfd *arch; unsigned int elength; { diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 4cf87df..d3da8df 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -88,6 +88,11 @@ typedef struct _bfd bfd; #if defined (__GNUG__) && (__GNUC_MINOR__ > 5) #define TRUE_FALSE_ALREADY_DEFINED #endif +#ifdef MPW +/* Pre-emptive strike - get the file with the enum. */ +#include <Types.h> +#define TRUE_FALSE_ALREADY_DEFINED +#endif /* MPW */ #ifndef TRUE_FALSE_ALREADY_DEFINED typedef enum bfd_boolean {false, true} boolean; #define BFD_TRUE_FALSE @@ -2209,6 +2214,7 @@ CAT(NAME,_slurp_extended_name_table),\ CAT(NAME,_construct_extended_name_table),\ CAT(NAME,_truncate_arname),\ CAT(NAME,_write_armap),\ +CAT(NAME,_read_ar_hdr),\ CAT(NAME,_openr_next_archived_file),\ CAT(NAME,_generic_stat_arch_elt),\ CAT(NAME,_update_armap_timestamp) @@ -2222,6 +2228,7 @@ CAT(NAME,_update_armap_timestamp) struct orl *map, unsigned int orl_count, int stridx)); + PTR (*_bfd_read_ar_hdr) PARAMS ((bfd *)); bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index ba2050d..dd68b8a 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -90,7 +90,6 @@ bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); -struct areltdata *_bfd_snarf_ar_hdr PARAMS ((bfd *abfd)); const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd)); boolean bfd_slurp_armap PARAMS ((bfd *abfd)); boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd)); @@ -100,6 +99,7 @@ boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd)); extern boolean _bfd_construct_extended_name_table PARAMS ((bfd *, boolean, char **, bfd_size_type *)); boolean _bfd_write_archive_contents PARAMS ((bfd *abfd)); +boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength)); bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos)); bfd * _bfd_new_bfd PARAMS ((void)); @@ -128,11 +128,15 @@ boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)); +extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *)); + bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive, bfd *last_file)); int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +#define _bfd_read_ar_hdr(abfd) \ + BFD_SEND (abfd, _bfd_read_ar_hdr, (abfd)) /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ @@ -183,6 +187,7 @@ extern boolean _bfd_nocore_core_file_matches_executable_p ((boolean (*) \ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ bfd_false) +#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr #define _bfd_noarchive_openr_next_archived_file \ ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt @@ -198,6 +203,7 @@ extern boolean _bfd_archive_bsd_construct_extended_name_table PARAMS ((bfd *, char **, bfd_size_type *, const char **)); #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_openr_next_archived_file \ bfd_generic_openr_next_archived_file #define _bfd_archive_bsd_generic_stat_arch_elt \ @@ -214,6 +220,7 @@ extern boolean _bfd_archive_coff_construct_extended_name_table PARAMS ((bfd *, char **, bfd_size_type *, const char **)); #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_openr_next_archived_file \ bfd_generic_openr_next_archived_file #define _bfd_archive_coff_generic_stat_arch_elt \ @@ -420,7 +427,7 @@ extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *)); #define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) #define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) -void bfd_assert PARAMS ((char*,int)); +void bfd_assert PARAMS ((const char*,int)); #define BFD_ASSERT(x) \ { if (!(x)) bfd_assert(__FILE__,__LINE__); } @@ -446,18 +453,20 @@ extern bfd *bfd_last_cache; extern const bfd_target * const bfd_target_vector[]; extern const bfd_target * const bfd_default_vector[]; -/* A function shared by the ECOFF and MIPS ELF backends, which have no +/* Functions shared by the ECOFF and MIPS ELF backends, which have no other common header files. */ #if defined(__STDC__) || defined(ALMOST_STDC) struct ecoff_find_line; #endif -extern boolean -_bfd_ecoff_locate_line +extern boolean _bfd_ecoff_locate_line PARAMS ((bfd *, asection *, bfd_vma, struct ecoff_debug_info * const, const struct ecoff_debug_swap * const, struct ecoff_find_line *, const char **, const char **, unsigned int *)); +extern boolean _bfd_ecoff_get_accumulated_pdr PARAMS ((PTR, bfd_byte *)); +extern boolean _bfd_ecoff_get_accumulated_sym PARAMS ((PTR, bfd_byte *)); +extern boolean _bfd_ecoff_get_accumulated_ss PARAMS ((PTR, bfd_byte *)); /* And more follows */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index a57e292..e86f355 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -90,7 +90,6 @@ bfd * _bfd_create_empty_archive_element_shell PARAMS ((bfd *obfd)); bfd * _bfd_look_for_bfd_in_cache PARAMS ((bfd *arch_bfd, file_ptr index)); boolean _bfd_add_bfd_to_archive_cache PARAMS ((bfd *, file_ptr, bfd *)); boolean _bfd_generic_mkarchive PARAMS ((bfd *abfd)); -struct areltdata *_bfd_snarf_ar_hdr PARAMS ((bfd *abfd)); const bfd_target *bfd_generic_archive_p PARAMS ((bfd *abfd)); boolean bfd_slurp_armap PARAMS ((bfd *abfd)); boolean bfd_slurp_bsd_armap_f2 PARAMS ((bfd *abfd)); @@ -100,6 +99,7 @@ boolean _bfd_slurp_extended_name_table PARAMS ((bfd *abfd)); extern boolean _bfd_construct_extended_name_table PARAMS ((bfd *, boolean, char **, bfd_size_type *)); boolean _bfd_write_archive_contents PARAMS ((bfd *abfd)); +boolean _bfd_compute_and_write_armap PARAMS ((bfd *, unsigned int elength)); bfd *_bfd_get_elt_at_filepos PARAMS ((bfd *archive, file_ptr filepos)); bfd * _bfd_new_bfd PARAMS ((void)); @@ -128,11 +128,15 @@ boolean bsd_write_armap PARAMS ((bfd *arch, unsigned int elength, boolean coff_write_armap PARAMS ((bfd *arch, unsigned int elength, struct orl *map, unsigned int orl_count, int stridx)); +extern PTR _bfd_generic_read_ar_hdr PARAMS ((bfd *)); + bfd * bfd_generic_openr_next_archived_file PARAMS ((bfd *archive, bfd *last_file)); int bfd_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); +#define _bfd_read_ar_hdr(abfd) \ + BFD_SEND (abfd, _bfd_read_ar_hdr, (abfd)) /* Generic routines to use for BFD_JUMP_TABLE_GENERIC. Use BFD_JUMP_TABLE_GENERIC (_bfd_generic). */ @@ -183,6 +187,7 @@ extern boolean _bfd_nocore_core_file_matches_executable_p ((boolean (*) \ PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int))) \ bfd_false) +#define _bfd_noarchive_read_ar_hdr bfd_nullvoidptr #define _bfd_noarchive_openr_next_archived_file \ ((bfd *(*) PARAMS ((bfd *, bfd *))) bfd_nullvoidptr) #define _bfd_noarchive_generic_stat_arch_elt bfd_generic_stat_arch_elt @@ -198,6 +203,7 @@ extern boolean _bfd_archive_bsd_construct_extended_name_table PARAMS ((bfd *, char **, bfd_size_type *, const char **)); #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_openr_next_archived_file \ bfd_generic_openr_next_archived_file #define _bfd_archive_bsd_generic_stat_arch_elt \ @@ -214,6 +220,7 @@ extern boolean _bfd_archive_coff_construct_extended_name_table PARAMS ((bfd *, char **, bfd_size_type *, const char **)); #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_openr_next_archived_file \ bfd_generic_openr_next_archived_file #define _bfd_archive_coff_generic_stat_arch_elt \ @@ -420,7 +427,7 @@ extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *)); #define bfd_read_p(abfd) ((abfd)->direction == read_direction || (abfd)->direction == both_direction) #define bfd_write_p(abfd) ((abfd)->direction == write_direction || (abfd)->direction == both_direction) -void bfd_assert PARAMS ((char*,int)); +void bfd_assert PARAMS ((const char*,int)); #define BFD_ASSERT(x) \ { if (!(x)) bfd_assert(__FILE__,__LINE__); } diff --git a/bfd/targets.c b/bfd/targets.c index 6728002..78a57a5 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -301,6 +301,7 @@ The general target vector. .CAT(NAME,_construct_extended_name_table),\ .CAT(NAME,_truncate_arname),\ .CAT(NAME,_write_armap),\ +.CAT(NAME,_read_ar_hdr),\ .CAT(NAME,_openr_next_archived_file),\ .CAT(NAME,_generic_stat_arch_elt),\ .CAT(NAME,_update_armap_timestamp) @@ -314,6 +315,7 @@ The general target vector. . struct orl *map, . unsigned int orl_count, . int stridx)); +. PTR (*_bfd_read_ar_hdr) PARAMS ((bfd *)); . bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev)); . int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *)); . boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *)); @@ -533,6 +535,7 @@ extern const bfd_target pc532netbsd_vec; extern const bfd_target oasys_vec; extern const bfd_target pc532machaout_vec; extern const bfd_target riscix_vec; +extern const bfd_target pmac_xcoff_vec; extern const bfd_target rs6000coff_vec; extern const bfd_target shcoff_vec; /* start-sanitize-rce */ @@ -709,6 +712,10 @@ const bfd_target * const bfd_target_vector[] = { &aout_arm_little_vec, &riscix_vec, #endif +#if 0 + /* This has the same magic number as RS/6000. */ + &pmac_xcoff_vec, +#endif &rs6000coff_vec, &shcoff_vec, &shlcoff_vec, |