From 9bd09e220fef247580c9736ab0d680c875c11f93 Mon Sep 17 00:00:00 2001 From: Nicholas Duffek Date: Fri, 16 Jun 2000 20:35:08 +0000 Subject: [PATCH] * bfd-in.h (bfd_family_coff): Define. * bfd-in2.h: Regenerate. * coffgen.c (coff_count_linenumbers, coff_symbol_from, coff_find_nearest_line): Check COFFness using bfd_family_coff() instead of bfd_target_coff_flavour. * cofflink.c (_bfd_coff_final_link): Likewise. * cpu-ns32k.c (do_ns32k_reloc): Don't strcmp() target name to exclude XCOFF files. * reloc.c (bfd_perform_relocation, bfd_install_relocation): Likewise. * targets.c (enum bfd_flavour): Add bfd_target_xcoff_flavour. * xcoff-target.h (TARGET_SYM): Use bfd_target_xcoff_flavour. * xcofflink.c (XCOFF_XVECP): Delete. (bfd_xcoff_link_record_set, bfd_xcoff_import_symbol, bfd_xcoff_export_symbol, bfd_xcoff_link_count_reloc, bfd_xcoff_record_link_assignment, bfd_xcoff_size_dynamic_sections): Replace XCOFF_XVECP() with check for bfd_target_xcoff_flavour. --- bfd/ChangeLog | 21 +++++++++++++++++++++ bfd/bfd-in.h | 3 +++ bfd/bfd-in2.h | 4 ++++ bfd/coffgen.c | 6 +++--- bfd/cofflink.c | 3 +-- bfd/cpu-ns32k.c | 3 +-- bfd/reloc.c | 6 ------ bfd/targets.c | 1 + bfd/xcoff-target.h | 2 +- bfd/xcofflink.c | 21 ++++++--------------- 10 files changed, 41 insertions(+), 29 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 832f653..1597354 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,26 @@ 2000-06-16 Nicholas Duffek + * bfd-in.h (bfd_family_coff): Define. + * bfd-in2.h: Regenerate. + * coffgen.c (coff_count_linenumbers, coff_symbol_from, + coff_find_nearest_line): Check COFFness using bfd_family_coff() + instead of bfd_target_coff_flavour. + * cofflink.c (_bfd_coff_final_link): Likewise. + * cpu-ns32k.c (do_ns32k_reloc): Don't strcmp() target name to + exclude XCOFF files. + * reloc.c (bfd_perform_relocation, bfd_install_relocation): + Likewise. + * targets.c (enum bfd_flavour): Add bfd_target_xcoff_flavour. + * xcoff-target.h (TARGET_SYM): Use bfd_target_xcoff_flavour. + * xcofflink.c (XCOFF_XVECP): Delete. + (bfd_xcoff_link_record_set, bfd_xcoff_import_symbol, + bfd_xcoff_export_symbol, bfd_xcoff_link_count_reloc, + bfd_xcoff_record_link_assignment, + bfd_xcoff_size_dynamic_sections): Replace XCOFF_XVECP() with + check for bfd_target_xcoff_flavour. + +2000-06-16 Nicholas Duffek + * rs6000-core.c: Support 64-bit core files, support pre-4.3 core files on AIX 4.3. (read_hdr): New function. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index dc172bf..26a9080 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -489,6 +489,9 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *)); #define bfd_get_format(abfd) ((abfd)->format) #define bfd_get_target(abfd) ((abfd)->xvec->name) #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) +#define bfd_family_coff(abfd) \ + (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ + bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) #define bfd_header_big_endian(abfd) \ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index a3f6d8c..561a24e 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -489,6 +489,9 @@ extern int bfd_stat PARAMS ((bfd *abfd, struct stat *)); #define bfd_get_format(abfd) ((abfd)->format) #define bfd_get_target(abfd) ((abfd)->xvec->name) #define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) +#define bfd_family_coff(abfd) \ + (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ + bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) #define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) #define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) #define bfd_header_big_endian(abfd) \ @@ -3057,6 +3060,7 @@ enum bfd_flavour { bfd_target_aout_flavour, bfd_target_coff_flavour, bfd_target_ecoff_flavour, + bfd_target_xcoff_flavour, bfd_target_elf_flavour, bfd_target_ieee_flavour, bfd_target_nlm_flavour, diff --git a/bfd/coffgen.c b/bfd/coffgen.c index bb7f862..dee819b 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -525,7 +525,7 @@ coff_count_linenumbers (abfd) { asymbol *q_maybe = *p; - if (bfd_asymbol_flavour (q_maybe) == bfd_target_coff_flavour) + if (bfd_family_coff (bfd_asymbol_bfd (q_maybe))) { coff_symbol_type *q = coffsymbol (q_maybe); @@ -564,7 +564,7 @@ coff_symbol_from (ignore_abfd, symbol) bfd *ignore_abfd ATTRIBUTE_UNUSED; asymbol *symbol; { - if (bfd_asymbol_flavour (symbol) != bfd_target_coff_flavour) + if (!bfd_family_coff (bfd_asymbol_bfd (symbol))) return (coff_symbol_type *) NULL; if (bfd_asymbol_bfd (symbol)->tdata.coff_obj_data == (coff_data_type *) NULL) @@ -2200,7 +2200,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr, *line_ptr = 0; /* Don't try and find line numbers in a non coff file */ - if (abfd->xvec->flavour != bfd_target_coff_flavour) + if (!bfd_family_coff (abfd)) return false; if (cof == NULL) diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 609f665..b648fa1 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -894,8 +894,7 @@ _bfd_coff_final_link (abfd, info) for (p = o->link_order_head; p != NULL; p = p->next) { if (p->type == bfd_indirect_link_order - && (bfd_get_flavour (p->u.indirect.section->owner) - == bfd_target_coff_flavour)) + && bfd_family_coff (p->u.indirect.section->owner)) { sub = p->u.indirect.section->owner; if (! bfd_coff_link_output_has_begun (sub, & finfo)) diff --git a/bfd/cpu-ns32k.c b/bfd/cpu-ns32k.c index f74e25b..c49630c 100644 --- a/bfd/cpu-ns32k.c +++ b/bfd/cpu-ns32k.c @@ -290,8 +290,7 @@ do_ns32k_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, reloc_entry->address += input_section->output_offset; /* WTF?? */ - if (abfd->xvec->flavour == bfd_target_coff_flavour - && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0) + if (abfd->xvec->flavour == bfd_target_coff_flavour) { #if 1 /* For m68k-coff, the addend was being subtracted twice during diff --git a/bfd/reloc.c b/bfd/reloc.c index 7b86e37..a14d552 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -728,9 +728,6 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, /* WTF?? */ if (abfd->xvec->flavour == bfd_target_coff_flavour - && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 - && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0 - && strcmp (abfd->xvec->name, "xcoff-powermac") != 0 && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) { @@ -1125,9 +1122,6 @@ bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, /* WTF?? */ if (abfd->xvec->flavour == bfd_target_coff_flavour - && strcmp (abfd->xvec->name, "aixcoff-rs6000") != 0 - && strcmp (abfd->xvec->name, "aixcoff64-rs6000") != 0 - && strcmp (abfd->xvec->name, "xcoff-powermac") != 0 && strcmp (abfd->xvec->name, "coff-Intel-little") != 0 && strcmp (abfd->xvec->name, "coff-Intel-big") != 0) { diff --git a/bfd/targets.c b/bfd/targets.c index 1421552..980f95c 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -141,6 +141,7 @@ DESCRIPTION . bfd_target_aout_flavour, . bfd_target_coff_flavour, . bfd_target_ecoff_flavour, +. bfd_target_xcoff_flavour, . bfd_target_elf_flavour, . bfd_target_ieee_flavour, . bfd_target_nlm_flavour, diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h index 04c391a..18084e6 100644 --- a/bfd/xcoff-target.h +++ b/bfd/xcoff-target.h @@ -151,7 +151,7 @@ extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int, const bfd_target TARGET_SYM = { TARGET_NAME, - bfd_target_coff_flavour, + bfd_target_xcoff_flavour, BFD_ENDIAN_BIG, /* data byte order is big */ BFD_ENDIAN_BIG, /* header byte order is big */ diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 17517b0..2d03fa4 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -29,15 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define STRING_SIZE_SIZE (4) -/* In order to support linking different object file formats into an - XCOFF format, we need to be able to determine whether a particular - bfd_target is an XCOFF vector. FIXME: We need to rethink this - whole approach. */ -#define XCOFF_XVECP(xv) \ - (strcmp ((xv)->name, "aixcoff-rs6000") == 0 \ - || strcmp ((xv)->name, "aixcoff64-rs6000") == 0 \ - || strcmp ((xv)->name, "xcoff-powermac") == 0) - /* Get the XCOFF hash table entries for a BFD. */ #define obj_xcoff_sym_hashes(bfd) \ ((struct xcoff_link_hash_entry **) obj_coff_sym_hashes (bfd)) @@ -2916,7 +2907,7 @@ bfd_xcoff_link_record_set (output_bfd, info, harg, size) struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; struct xcoff_link_size_list *n; - if (! XCOFF_XVECP (output_bfd->xvec)) + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return true; /* This will hardly ever be called. I don't want to burn four bytes @@ -2952,7 +2943,7 @@ bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile, { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; - if (! XCOFF_XVECP (output_bfd->xvec)) + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return true; /* A symbol name which starts with a period is the code for a @@ -3066,7 +3057,7 @@ bfd_xcoff_export_symbol (output_bfd, info, harg, syscall) { struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg; - if (! XCOFF_XVECP (output_bfd->xvec)) + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return true; h->flags |= XCOFF_EXPORT; @@ -3131,7 +3122,7 @@ bfd_xcoff_link_count_reloc (output_bfd, info, name) { struct xcoff_link_hash_entry *h; - if (! XCOFF_XVECP (output_bfd->xvec)) + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return true; h = ((struct xcoff_link_hash_entry *) @@ -3165,7 +3156,7 @@ bfd_xcoff_record_link_assignment (output_bfd, info, name) { struct xcoff_link_hash_entry *h; - if (! XCOFF_XVECP (output_bfd->xvec)) + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) return true; h = xcoff_link_hash_lookup (xcoff_hash_table (info), name, true, true, @@ -3250,7 +3241,7 @@ bfd_xcoff_size_dynamic_sections (output_bfd, info, libpath, entry, struct bfd_strtab_hash *debug_strtab; bfd_byte *debug_contents = NULL; - if (! XCOFF_XVECP (output_bfd->xvec)) + if (bfd_get_flavour (output_bfd) != bfd_target_xcoff_flavour) { for (i = 0; i < 6; i++) special_sections[i] = NULL; -- 2.7.4