X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fecofflink.c;h=9b2e0f544e47ae041800ac98cc8d2b061a6f2c5a;hb=1abaf976022c1e6b388292115d733f281c5a90e7;hp=7982945951f817660e857781a56dfa325dead3eb;hpb=fa803dc60f0bf01297674c41d001798e18ade4dc;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 7982945951..9b2e0f544e 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1,5 +1,5 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc. + Copyright 1993, 94, 95, 96, 97, 99, 2000 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. @@ -28,6 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "coff/sym.h" #include "coff/symconst.h" #include "coff/ecoff.h" +#include "libcoff.h" +#include "libecoff.h" static boolean ecoff_add_bytes PARAMS ((char **buf, char **bufend, size_t need)); @@ -67,8 +69,8 @@ _bfd_ecoff_swap_tir_in (bigend, ext_copy, intern) struct tir_ext ext[1]; *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ + + /* now the fun stuff... */ if (bigend) { intern->fBitfield = 0 != (ext->t_bits1[0] & TIR_BITS1_FBITFIELD_BIG); intern->continued = 0 != (ext->t_bits1[0] & TIR_BITS1_CONTINUED_BIG); @@ -107,7 +109,7 @@ _bfd_ecoff_swap_tir_in (bigend, ext_copy, intern) #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); + abort (); #endif } @@ -124,8 +126,8 @@ _bfd_ecoff_swap_tir_out (bigend, intern_copy, ext) TIR intern[1]; *intern = *intern_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ + + /* now the fun stuff... */ if (bigend) { ext->t_bits1[0] = ((intern->fBitfield ? TIR_BITS1_FBITFIELD_BIG : 0) | (intern->continued ? TIR_BITS1_CONTINUED_BIG : 0) @@ -164,7 +166,7 @@ _bfd_ecoff_swap_tir_out (bigend, intern_copy, ext) #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); + abort (); #endif } @@ -180,8 +182,8 @@ _bfd_ecoff_swap_rndx_in (bigend, ext_copy, intern) struct rndx_ext ext[1]; *ext = *ext_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ + + /* now the fun stuff... */ if (bigend) { intern->rfd = (ext->r_bits[0] << RNDX_BITS0_RFD_SH_LEFT_BIG) | ((ext->r_bits[1] & RNDX_BITS1_RFD_BIG) @@ -203,7 +205,7 @@ _bfd_ecoff_swap_rndx_in (bigend, ext_copy, intern) #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); + abort (); #endif } @@ -219,8 +221,8 @@ _bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext) RNDXR intern[1]; *intern = *intern_copy; /* Make it reasonable to do in-place. */ - - /* now the fun stuff... */ + + /* now the fun stuff... */ if (bigend) { ext->r_bits[0] = intern->rfd >> RNDX_BITS0_RFD_SH_LEFT_BIG; ext->r_bits[1] = (((intern->rfd << RNDX_BITS1_RFD_SH_BIG) @@ -241,7 +243,7 @@ _bfd_ecoff_swap_rndx_out (bigend, intern_copy, ext) #ifdef TEST if (memcmp ((char *)ext, (char *)intern, sizeof (*intern)) != 0) - abort(); + abort (); #endif } @@ -463,7 +465,7 @@ add_memory_shuffle (ainfo, head, tail, data, size) unsigned long size; { struct shuffle *n; - + n = (struct shuffle *) objalloc_alloc (ainfo->memory, sizeof (struct shuffle)); if (!n) @@ -486,12 +488,11 @@ add_memory_shuffle (ainfo, head, tail, data, size) /* Initialize the FDR hash table. This returns a handle which is then passed in to bfd_ecoff_debug_accumulate, et. al. */ -/*ARGSUSED*/ PTR bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info) - bfd *output_bfd; + bfd *output_bfd ATTRIBUTE_UNUSED; struct ecoff_debug_info *output_debug; - const struct ecoff_debug_swap *output_swap; + const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED; struct bfd_link_info *info; { struct accumulate *ainfo; @@ -545,17 +546,16 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info) /* Free the accumulated debugging information. */ -/*ARGSUSED*/ void bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info) PTR handle; - bfd *output_bfd; - struct ecoff_debug_info *output_debug; - const struct ecoff_debug_swap *output_swap; + bfd *output_bfd ATTRIBUTE_UNUSED; + struct ecoff_debug_info *output_debug ATTRIBUTE_UNUSED; + const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED; struct bfd_link_info *info; { struct accumulate *ainfo = (struct accumulate *) handle; - + bfd_hash_table_free (&ainfo->fdr_hash.table); if (! info->relocateable) @@ -574,7 +574,6 @@ bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info) linker information structure. HANDLE is returned by bfd_ecoff_debug_init. */ -/*ARGSUSED*/ boolean bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, input_bfd, input_debug, input_swap, @@ -704,17 +703,18 @@ bfd_ecoff_debug_accumulate (handle, output_bfd, output_debug, output_swap, struct string_hash_entry *fh; /* We look up a string formed from the file name and the - number of symbols. Sometimes an include file will - conditionally define a typedef or something based on the - order of include files. Using the number of symbols as a - hash reduces the chance that we will merge symbol - information that should not be merged. */ + number of symbols and aux entries. Sometimes an include + file will conditionally define a typedef or something + based on the order of include files. Using the number of + symbols and aux entries as a hash reduces the chance that + we will merge symbol information that should not be + merged. */ name = input_debug->ss + fdr.issBase + fdr.rss; lookup = (char *) bfd_malloc (strlen (name) + 20); if (lookup == NULL) return false; - sprintf (lookup, "%s %lx", name, fdr.csym); + sprintf (lookup, "%s %lx %lx", name, fdr.csym, fdr.caux); fh = string_hash_lookup (&ainfo->fdr_hash, lookup, true, true); free (lookup); @@ -1406,10 +1406,9 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym) /* Align the ECOFF debugging information. */ -/*ARGSUSED*/ static void ecoff_align_debug (abfd, debug, swap) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; struct ecoff_debug_info *debug; const struct ecoff_debug_swap *swap; { @@ -1964,9 +1963,9 @@ lookup_line (abfd, debug_info, debug_swap, line_info) boolean stabs; FDR *fdr_ptr; int i; - + offset = line_info->cache.start; - + /* Build FDR table (sorted by object file's base-address) if we don't have it already. */ if (line_info->fdrtab == NULL @@ -1978,7 +1977,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) /* find first FDR for address OFFSET */ i = fdrtab_lookup (line_info, offset); if (i < 0) - return false; /* no FDR, no fun... */ + return false; /* no FDR, no fun... */ fdr_ptr = tab[i].fdr; /* Check whether this file has stabs debugging information. In a @@ -2043,9 +2042,9 @@ lookup_line (abfd, debug_info, debug_swap, line_info) malloc.c. I'm not sure why this happens, but it could be due to optimizations that reorder a function's position within an object-file. - + Strategy: - + On the first call to this function, we build a table of FDRs that is sorted by the base-address of the object-file the FDR is referring to. Notice that each object-file may contain @@ -2076,9 +2075,9 @@ lookup_line (abfd, debug_info, debug_swap, line_info) bfd_vma dist, min_dist = 0; char *pdr_hold; char *pdr_end; - + fdr_ptr = tab[i].fdr; - + pdr_ptr = ((char *) debug_info->external_pdr + fdr_ptr->ipdFirst * external_pdr_size); pdr_end = pdr_ptr + fdr_ptr->cpd * external_pdr_size; @@ -2103,7 +2102,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) } } } - + if (!best_pdr || min_dist < best_dist) { best_dist = min_dist; @@ -2116,7 +2115,7 @@ lookup_line (abfd, debug_info, debug_swap, line_info) && tab[i].base_addr == tab[i - 1].base_addr); if (!best_fdr || !best_pdr) - return false; /* shouldn't happen... */ + return false; /* shouldn't happen... */ /* phew, finally we got something that we can hold onto: */ fdr_ptr = best_fdr;