]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* libcoff.h (obj_raw_syment_coun): New macro.
authorPer Bothner <per@bothner.com>
Tue, 23 Feb 1993 06:50:49 +0000 (06:50 +0000)
committerPer Bothner <per@bothner.com>
Tue, 23 Feb 1993 06:50:49 +0000 (06:50 +0000)
* coffgen.c (coff_get_normalized_symtab):  Initialize
raw_syment_count.
* coffgen.c (coff_find_nearest_line):  Numerous little fixes.

bfd/ChangeLog
bfd/coffgen.c
bfd/libcoff.h

index e3e61ca0a4d93582c65637b912a6af2dbde99d5f..0598d9cd94608f6a6dbb765720d7bec61c48612f 100644 (file)
@@ -1,3 +1,10 @@
+Mon Feb 22 18:40:06 1993  Per Bothner  (bothner@rtl.cygnus.com)
+
+       * libcoff.h (obj_raw_syment_coun):  New macro.
+       * coffgen.c (coff_get_normalized_symtab):  Initialize
+       raw_syment_count.
+       * coffgen.c (coff_find_nearest_line):  Numerous little fixes.
+
 Mon Feb 22 15:03:07 1993  Ian Lance Taylor  (ian@cygnus.com)
 
        * coff-mips.c (ecoff_set_symbol_info): stBlock symbols are always
index 21f023ee23c49db2d75e5645138e5c9b61b4ae2c..5c4b9d493dcfc44c828a231b7c6dda82ef927f70 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for the generic parts of COFF, for BFD.
-   Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -1125,7 +1125,7 @@ bfd            *abfd)
       internal_ptr->fix_tag = 0;
       internal_ptr->fix_end = 0;
       symbol_ptr = internal_ptr;
-    
+
       for (i = 0;
           i < symbol_ptr->u.syment.n_numaux;
           i++) 
@@ -1223,6 +1223,7 @@ bfd            *abfd)
   }
 
   obj_raw_syments(abfd) = internal;
+  obj_raw_syment_count(abfd) = internal_ptr - internal;
 
   return (internal);
 }                              /* coff_get_normalized_symtab() */
@@ -1403,14 +1404,14 @@ DEFUN(coff_find_nearest_line,(abfd,
   static asection *cache_section;
   static bfd_vma  cache_offset;
   static unsigned int cache_i;
-  static alent   *cache_l;
+  static CONST char *cache_function;
+  static unsigned int    line_base = 0;
 
   unsigned int    i = 0;
   coff_data_type *cof = coff_data(abfd);
   /* Run through the raw syments if available */
   combined_entry_type *p;
   alent          *l;
-  unsigned int    line_base = 0;
 
 
   *filename_ptr = 0;
@@ -1444,17 +1445,19 @@ DEFUN(coff_find_nearest_line,(abfd,
       section == cache_section &&
       offset >= cache_offset) {
     i = cache_i;
-    l = cache_l;
+    *functionname_ptr = cache_function;
   }
   else {
     i = 0;
-    l = section->lineno;
   }
+  l = &section->lineno[i];
 
   for (; i < section->lineno_count; i++) {
     if (l->line_number == 0) {
       /* Get the symbol this line number points at */
       coff_symbol_type *coff = (coff_symbol_type *) (l->u.sym);
+      if (coff->symbol.value > offset)
+       break;
       *functionname_ptr = coff->symbol.name;
       if (coff->native) {
        combined_entry_type  *s = coff->native;
@@ -1468,13 +1471,14 @@ DEFUN(coff_find_nearest_line,(abfd,
            */
          union internal_auxent   *a = &((s + 1)->u.auxent);
          line_base = a->x_sym.x_misc.x_lnsz.x_lnno;
+         *line_ptr = line_base;
        }
       }
     }
     else {
       if (l->u.offset > offset)
        break;
-      *line_ptr = l->line_number + line_base + 1;
+      *line_ptr = l->line_number + line_base - 1;
     }
     l++;
   }
@@ -1483,7 +1487,7 @@ DEFUN(coff_find_nearest_line,(abfd,
   cache_section = section;
   cache_offset = offset;
   cache_i = i;
-  cache_l = l;
+  cache_function = *functionname_ptr;
 
   return true;
 }
index b3723806ff666ae0cc45c2485a3bfadb3b67ca23..fd80f71295ba54cc46a2ddb3e2ed38bdff9eeb13 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD COFF object file private structure.
-   Copyright (C) 1990-1991 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #define obj_relocbase(bfd)     (coff_data(bfd)->relocbase)
 #define obj_raw_syments(bfd)   (coff_data(bfd)->raw_syments)
+#define obj_raw_syment_count(bfd)      (coff_data(bfd)->raw_syment_count)
 #define obj_convert(bfd)       (coff_data(bfd)->conversion_table)
 #define obj_conv_table_size(bfd) (coff_data(bfd)->conv_table_size)
 #if CFILE_STUFF
@@ -78,7 +79,7 @@ extern bfd_target *coff_object_p PARAMS ((bfd *));
 extern struct sec *coff_section_from_bfd_index PARAMS ((bfd *, int));
 extern unsigned int coff_get_symtab_upper_bound PARAMS ((bfd *));
 extern unsigned int coff_get_symtab PARAMS ((bfd *, asymbol **));
-extern void coff_count_linenumbers PARAMS ((bfd *));
+extern int coff_count_linenumbers PARAMS ((bfd *));
 extern struct coff_symbol_struct *coff_symbol_from PARAMS ((bfd *, asymbol *));
 extern void coff_renumber_symbols PARAMS ((bfd *));
 extern void coff_mangle_symbols PARAMS ((bfd *));
@@ -234,7 +235,8 @@ typedef struct
        PTR     internal_filehdr));
  PTR (*_bfd_coff_mkobject_hook) PARAMS ((
        bfd     *abfd,
-       PTR     internal_filehdr));
+       PTR     internal_filehdr,
+       PTR     internal_aouthdr));
  flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
        bfd     *abfd,
        PTR     internal_scnhdr));
@@ -312,8 +314,8 @@ typedef struct
 
 #define bfd_coff_set_arch_mach_hook(abfd, filehdr)\
         ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr))
-#define bfd_coff_mkobject_hook(abfd, filehdr)\
-        ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr))
+#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
+        ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
 
 #define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr)\
         ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr))