From a2546fcef767bb388f8fc4d90b0b04c2ad7063e3 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 5 Jul 1995 16:31:07 +0000 Subject: [PATCH] * ecoff.c (_bfd_ecoff_bfd_is_local_label): New function. * libecoff.h (_bfd_ecoff_bfd_is_local_label): Declare. * elf32-mips.c (mips_elf_is_local_label): New static function. (bfd_elf32_bfd_is_local_label): Define. PR 6978. --- bfd/ChangeLog | 5 +++++ bfd/ecoff.c | 11 +++++++++++ bfd/elf32-mips.c | 20 +++++++++++++++++--- bfd/libecoff.h | 44 +++++++++++++++++++++++++++++++++++++------- 4 files changed, 70 insertions(+), 10 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 772a2523b64..f83f58cb0d2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ Wed Jul 5 10:31:47 1995 Ian Lance Taylor + * ecoff.c (_bfd_ecoff_bfd_is_local_label): New function. + * libecoff.h (_bfd_ecoff_bfd_is_local_label): Declare. + * elf32-mips.c (mips_elf_is_local_label): New static function. + (bfd_elf32_bfd_is_local_label): Define. + * configure.in: Use $ac_config_sub, not $configsub. * configure: Likewise. diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 21d81d996b4..b85bf41d204 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1467,6 +1467,17 @@ _bfd_ecoff_get_symbol_info (abfd, symbol, ret) bfd_symbol_info (symbol, ret); } +/* Return whether this is a local label. */ + +/*ARGSUSED*/ +boolean +_bfd_ecoff_bfd_is_local_label (abfd, symbol) + bfd *abfd; + asymbol *symbol; +{ + return symbol->name[0] == '$'; +} + /* Print information about an ECOFF symbol. */ void diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 9ec53938244..0ae106572ff 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -84,6 +84,8 @@ static boolean mips_elf_section_processing static void mips_elf_symbol_processing PARAMS ((bfd *, asymbol *)); static boolean mips_elf_read_ecoff_info PARAMS ((bfd *, asection *, struct ecoff_debug_info *)); +static boolean mips_elf_is_local_label + PARAMS ((bfd *, asymbol *)); static boolean mips_elf_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, unsigned int *)); @@ -791,8 +793,8 @@ mips_elf_gprel16_reloc (abfd, } } - return gprel16_with_gp (symbol, reloc_entry, input_section, relocateable, - data, elf_gp (output_bfd)); + return gprel16_with_gp (abfd, symbol, reloc_entry, input_section, + relocateable, data, elf_gp (output_bfd)); } static bfd_reloc_status_type @@ -1507,6 +1509,17 @@ mips_elf_read_ecoff_info (abfd, section, debug) return false; } +/* MIPS ELF local labels start with '$', not 'L'. */ + +/*ARGSUSED*/ +static boolean +mips_elf_is_local_label (abfd, symbol) + bfd *abfd; + asymbol *symbol; +{ + return symbol->name[0] == '$'; +} + /* MIPS ELF uses a special find_nearest_line routine in order the handle the ECOFF debugging information. */ @@ -2805,7 +2818,7 @@ elf32_mips_get_relocated_section_contents (abfd, link_info, link_order, data, lh = 0; else { - h = bfd_hash_lookup (link_info->hash, "_gp", false, false); + h = bfd_hash_lookup (&link_info->hash->table, "_gp", false, false); lh = (struct bfd_link_hash_entry *) h; } lookup: @@ -2990,6 +3003,7 @@ static const struct ecoff_debug_swap mips_elf_ecoff_debug_swap = mips_elf_final_write_processing #define elf_backend_ecoff_debug_swap &mips_elf_ecoff_debug_swap +#define bfd_elf32_bfd_is_local_label mips_elf_is_local_label #define bfd_elf32_find_nearest_line mips_elf_find_nearest_line #define bfd_elf32_bfd_link_hash_table_create \ diff --git a/bfd/libecoff.h b/bfd/libecoff.h index a6b8777021e..1b9d9a23bc3 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -50,7 +50,7 @@ struct ecoff_backend_data /* Bitsize of constructor entries. */ unsigned int constructor_bitsize; /* Reloc to use for constructor entries. */ - CONST struct reloc_howto_struct *constructor_reloc; + reloc_howto_type *constructor_reloc; /* How to swap debugging information. */ struct ecoff_debug_swap debug_swap; /* External reloc size. */ @@ -124,6 +124,11 @@ typedef struct ecoff_tdata /* True if this BFD was written by the backend linker. */ boolean linker; + /* Used by find_nearest_line entry point. The structure could be + included directly in this one, but there's no point to wasting + the memory just for the infrequently called find_nearest_line. */ + struct ecoff_find_line *find_line_info; + } ecoff_data_type; /* Each canonical asymbol really looks like this. */ @@ -149,11 +154,11 @@ typedef struct ecoff_symbol_struct macro is only ever applied to an asymbol. */ #define ecoffsymbol(asymbol) ((ecoff_symbol_type *) (&((asymbol)->the_bfd))) -/* This is a hack borrowed from coffcode.h; we need to save the index - of an external symbol when we write it out so that can set the - symbol index correctly when we write out the relocs. */ -#define ecoff_get_sym_index(symbol) ((unsigned long) (symbol)->udata) -#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata = (PTR) (idx)) +/* We need to save the index of an external symbol when we write it + out so that can set the symbol index correctly when we write out + the relocs. */ +#define ecoff_get_sym_index(symbol) ((symbol)->udata.i) +#define ecoff_set_sym_index(symbol, idx) ((symbol)->udata.i = (idx)) /* When generating MIPS embedded PIC code, the linker relaxes the code to turn PC relative branches into longer code sequences when the PC @@ -238,18 +243,30 @@ extern boolean _bfd_ecoff_new_section_hook extern boolean _bfd_ecoff_get_section_contents PARAMS ((bfd *, asection *, PTR location, file_ptr, bfd_size_type)); +#define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section + extern boolean _bfd_ecoff_bfd_copy_private_bfd_data PARAMS ((bfd *, bfd *)); #define _bfd_ecoff_bfd_copy_private_section_data \ _bfd_generic_bfd_copy_private_section_data +#define _bfd_ecoff_bfd_copy_private_symbol_data \ + _bfd_generic_bfd_copy_private_symbol_data + +#define _bfd_ecoff_bfd_merge_private_bfd_data \ + _bfd_generic_bfd_merge_private_bfd_data + +#define _bfd_ecoff_bfd_set_private_flags _bfd_generic_bfd_set_private_flags extern boolean _bfd_ecoff_slurp_armap PARAMS ((bfd *abfd)); #define _bfd_ecoff_slurp_extended_name_table _bfd_slurp_extended_name_table +#define _bfd_ecoff_construct_extended_name_table \ + _bfd_archive_bsd_construct_extended_name_table #define _bfd_ecoff_truncate_arname bfd_dont_truncate_arname extern boolean _bfd_ecoff_write_armap PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); #define _bfd_ecoff_openr_next_archived_file \ bfd_generic_openr_next_archived_file #define _bfd_ecoff_generic_stat_arch_elt bfd_generic_stat_arch_elt +#define _bfd_ecoff_update_armap_timestamp bfd_true extern long _bfd_ecoff_get_symtab_upper_bound PARAMS ((bfd *abfd)); extern long _bfd_ecoff_get_symtab PARAMS ((bfd *abfd, asymbol **alocation)); @@ -258,7 +275,8 @@ extern void _bfd_ecoff_print_symbol PARAMS ((bfd *, PTR filep, asymbol *, bfd_print_symbol_type)); extern void _bfd_ecoff_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); -#define _bfd_ecoff_bfd_is_local_label bfd_generic_is_local_label +extern boolean _bfd_ecoff_bfd_is_local_label + PARAMS ((bfd *, asymbol *)); #define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno extern boolean _bfd_ecoff_find_nearest_line PARAMS ((bfd *, asection *, asymbol **, bfd_vma offset, @@ -296,3 +314,15 @@ extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr)); extern flagword _bfd_ecoff_styp_to_sec_flags PARAMS ((bfd *abfd, PTR hdr, const char *name)); extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd)); + +/* ECOFF auxiliary information swapping routines. These are the same + for all ECOFF targets, so they are defined in ecofflink.c. */ + +extern void _bfd_ecoff_swap_tir_in + PARAMS ((int, const struct tir_ext *, TIR *)); +extern void _bfd_ecoff_swap_tir_out + PARAMS ((int, const TIR *, struct tir_ext *)); +extern void _bfd_ecoff_swap_rndx_in + PARAMS ((int, const struct rndx_ext *, RNDXR *)); +extern void _bfd_ecoff_swap_rndx_out + PARAMS ((int, const RNDXR *, struct rndx_ext *)); -- 2.30.2