From c80cc8332c2da0b25b5bd03e4f19458e9f2e3db3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 6 Oct 1995 19:19:48 +0000 Subject: [PATCH] * coffcode.h (bfd_coff_backend_data): Add new field _bfd_coff_pointerize_aux_hook. (coff_pointerize_aux_hook): Define as a function if RS6000COFF_C or I960, and as 0 otherwise. (bfd_coff_std_swap_table): Initialize new field. * libcoff.h: Rebuild. * coffgen.c (coff_pointerize_aux): Change parameters to take symbol pointer instead of type and class, and to take aux index. Call _bfd_coff_pointerize_aux_hook if it is defined. (coff_get_normalized_symtab): Always call coff_pointerize_aux. * coff-alpha.c (alpha_ecoff_backend_data): Initialize all fields. * coff-mips.c (mips_ecoff_backend_data): Likewise. --- bfd/ChangeLog | 13 ++++++++++ bfd/coff-alpha.c | 2 +- bfd/coff-mips.c | 2 +- bfd/coffcode.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++- bfd/coffgen.c | 46 +++++++++++++++------------------- bfd/libcoff.h | 12 ++++----- 6 files changed, 105 insertions(+), 35 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c3a81088311..c87895d4dda 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -8,6 +8,19 @@ Fri Oct 6 12:24:47 1995 Michael Meissner Fri Oct 6 12:04:02 1995 Ian Lance Taylor + * coffcode.h (bfd_coff_backend_data): Add new field + _bfd_coff_pointerize_aux_hook. + (coff_pointerize_aux_hook): Define as a function if RS6000COFF_C + or I960, and as 0 otherwise. + (bfd_coff_std_swap_table): Initialize new field. + * libcoff.h: Rebuild. + * coffgen.c (coff_pointerize_aux): Change parameters to take + symbol pointer instead of type and class, and to take aux index. + Call _bfd_coff_pointerize_aux_hook if it is defined. + (coff_get_normalized_symtab): Always call coff_pointerize_aux. + * coff-alpha.c (alpha_ecoff_backend_data): Initialize all fields. + * coff-mips.c (mips_ecoff_backend_data): Likewise. + * coff-rs6000.c: Add full support for AIX archives. Rewrite old read-only/host-only support. diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index d914d4de589..bc140a1fda7 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1976,7 +1976,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = alpha_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook, alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags, _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table, - NULL, NULL, NULL, NULL, NULL, NULL, NULL + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, /* Supported architecture. */ bfd_arch_alpha, diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index e1a269f91cb..527a0fcb016 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -2442,7 +2442,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = mips_ecoff_bad_format_hook, _bfd_ecoff_set_arch_mach_hook, _bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags, _bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table, - NULL, NULL, NULL, NULL, NULL, NULL, NULL + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, /* Supported architecture. */ bfd_arch_mips, diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 84f1ad4aefe..327d57590af 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -649,6 +649,12 @@ dependent COFF routines: . boolean (*_bfd_coff_symname_in_debug) PARAMS (( . bfd *abfd, . struct internal_syment *sym)); +. boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( +. bfd *abfd, +. combined_entry_type *table_base, +. combined_entry_type *symbol, +. unsigned int indaux, +. combined_entry_type *aux)); . void (*_bfd_coff_reloc16_extra_cases) PARAMS (( . bfd *abfd, . struct bfd_link_info *link_info, @@ -1169,6 +1175,63 @@ symname_in_debug_hook (abfd, sym) #endif +#ifdef RS6000COFF_C + +/* We don't want to pointerize the csect auxent of a C_EXT or C_HIDEXT + symbol. */ + +static boolean coff_pointerize_aux_hook + PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *)); + +/*ARGSUSED*/ +static boolean +coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) + bfd *abfd; + combined_entry_type *table_base; + combined_entry_type *symbol; + unsigned int indaux; + combined_entry_type *aux; +{ + int class = symbol->u.syment.n_sclass; + + /* Return true if we don't want to pointerize this aux entry, which + is the case for the last aux entry for a C_EXT or C_HIDEXT + symbol. */ + return ((class == C_EXT || class == C_HIDEXT) + && indaux + 1 == symbol->u.syment.n_numaux); +} + +#else +#ifdef I960 + +/* We don't want to pointerize bal entries. */ + +static boolean coff_pointerize_aux_hook + PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *)); + +/*ARGSUSED*/ +static boolean +coff_pointerize_aux_hook (abfd, table_base, symbol, indaux, aux) + bfd *abfd; + combined_entry_type *table_base; + combined_entry_type *symbol; + unsigned int indaux; + combined_entry_type *aux; +{ + /* Return true if we don't want to pointerize this aux entry, which + is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ + return indaux == 1 && symbol->u.syment.n_sclass == C_LEAFPROC; +} + +#else /* ! I960 */ + +#define coff_pointerize_aux_hook 0 + +#endif /* ! I960 */ +#endif /* ! RS6000COFF_C */ + /* SUBSUBSECTION Writing relocations @@ -2837,7 +2900,7 @@ static CONST bfd_coff_backend_data bfd_coff_std_swap_table = coff_swap_filehdr_in, coff_swap_aouthdr_in, coff_swap_scnhdr_in, coff_swap_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, - coff_slurp_symbol_table, symname_in_debug_hook, + coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, coff_reloc16_extra_cases, coff_reloc16_estimate, coff_sym_is_global, coff_compute_section_file_positions, coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 68588a222ff..b1fb60b7ac6 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -53,6 +53,9 @@ static boolean coff_write_alien_symbol static boolean coff_write_native_symbol PARAMS ((bfd *, coff_symbol_type *, unsigned int *, bfd_size_type *, asection **, bfd_size_type *)); +static void coff_pointerize_aux + PARAMS ((bfd *, combined_entry_type *, combined_entry_type *, + unsigned int, combined_entry_type *)); #define STRING_SIZE_SIZE (4) @@ -77,16 +80,7 @@ make_a_section_from_file (abfd, hdr, target_index) strncpy (name, (char *) &hdr->s_name[0], sizeof (hdr->s_name)); name[sizeof (hdr->s_name)] = 0; - return_section = bfd_make_section (abfd, name); - if (return_section == NULL) - return_section = bfd_coff_make_section_hook (abfd, name); - - /* Handle several sections of the same name. For example, if an executable - has two .bss sections, GDB better be able to find both of them - (PR 3562). */ - if (return_section == NULL) - return_section = bfd_make_section_anyway (abfd, name); - + return_section = bfd_make_section_anyway (abfd, name); if (return_section == NULL) return false; @@ -1195,13 +1189,23 @@ coff_section_symbol (abfd, name) pointers to syments. */ static void -coff_pointerize_aux (abfd, table_base, type, class, auxent) +coff_pointerize_aux (abfd, table_base, symbol, indaux, auxent) bfd *abfd; combined_entry_type *table_base; - unsigned int type; - unsigned int class; + combined_entry_type *symbol; + unsigned int indaux; combined_entry_type *auxent; { + int type = symbol->u.syment.n_type; + int class = symbol->u.syment.n_sclass; + + if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) + { + if ((*coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) + (abfd, table_base, symbol, indaux, auxent)) + return; + } + /* Don't bother if this is a file or a section */ if (class == C_STAT && type == T_NULL) return; @@ -1215,8 +1219,7 @@ coff_pointerize_aux (abfd, table_base, type, class, auxent) && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0) { auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p = - (table_base - + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l); + table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l; auxent->fix_end = 1; } /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can @@ -1492,17 +1495,8 @@ coff_get_normalized_symtab (abfd) symbol_ptr->u.syment.n_sclass, i, symbol_ptr->u.syment.n_numaux, &(internal_ptr->u.auxent)); - /* Remember that bal entries arn't pointerized */ - if (i != 1 || symbol_ptr->u.syment.n_sclass != C_LEAFPROC) - { - - coff_pointerize_aux (abfd, - internal, - symbol_ptr->u.syment.n_type, - symbol_ptr->u.syment.n_sclass, - internal_ptr); - } - + coff_pointerize_aux (abfd, internal, symbol_ptr, i, + internal_ptr); } } diff --git a/bfd/libcoff.h b/bfd/libcoff.h index 4e7d837b9a4..d136b03660e 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -391,9 +391,6 @@ typedef struct bfd *abfd, PTR internal_scnhdr, const char *name)); - asection *(*_bfd_make_section_hook) PARAMS (( - bfd *abfd, - char *name)); void (*_bfd_set_alignment_hook) PARAMS (( bfd *abfd, asection *sec, @@ -403,6 +400,12 @@ typedef struct boolean (*_bfd_coff_symname_in_debug) PARAMS (( bfd *abfd, struct internal_syment *sym)); + boolean (*_bfd_coff_pointerize_aux_hook) PARAMS (( + bfd *abfd, + combined_entry_type *table_base, + combined_entry_type *symbol, + unsigned int indaux, + combined_entry_type *aux)); void (*_bfd_coff_reloc16_extra_cases) PARAMS (( bfd *abfd, struct bfd_link_info *link_info, @@ -514,9 +517,6 @@ typedef struct #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\ ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name)) -#define bfd_coff_make_section_hook(abfd, name)\ - ((coff_backend_info (abfd)->_bfd_make_section_hook) (abfd, name)) - #define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\ ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr)) -- 2.30.2