obj-coff* now copes with C mingled listings
authorSteve Chamberlain <sac@cygnus>
Tue, 28 Jan 1992 03:43:23 +0000 (03:43 +0000)
committerSteve Chamberlain <sac@cygnus>
Tue, 28 Jan 1992 03:43:23 +0000 (03:43 +0000)
tc-h8300.c: better error messages

gas/config/obj-coffbfd.c
gas/config/obj-coffbfd.h

index 07ec33b5bf7a5aff2153b3f378174510310fd8e2..37f95b74276ee322732a53cc038c0707b1c6692f 100644 (file)
@@ -89,6 +89,7 @@ int text_lineno_number = 0;
 */
 static symbolS *previous_file_symbol = NULL;
 void c_symbol_merge();
+static int line_base;
 
 symbolS *c_section_symbol();
 bfd *abfd;
@@ -679,21 +680,34 @@ stack* st;
  * Handle .ln directives.
  */
 
-static void obj_coff_ln() {
-       if (def_symbol_in_progress != NULL) {
-               as_warn(".ln pseudo-op inside .def/.endef: ignored.");
-               demand_empty_rest_of_line();
-               return;
-       } /* wrong context */
-
-       c_line_new(0,
-                  obstack_next_free(&frags) - frag_now->fr_literal,
-                  get_absolute_expression(),
-                  frag_now);
+static void obj_coff_ln() 
+{
+  int l;
+    
+  if (def_symbol_in_progress != NULL) {
+      as_warn(".ln pseudo-op inside .def/.endef: ignored.");
+      demand_empty_rest_of_line();
+      return;
+    }                          /* wrong context */
 
-       demand_empty_rest_of_line();
-       return;
-} /* obj_coff_line() */
+  c_line_new(0,
+            obstack_next_free(&frags) - frag_now->fr_literal,
+            l = get_absolute_expression(),
+            frag_now);
+#ifndef NO_LISTING
+{
+  extern int listing;
+    
+  if (listing) 
+  {
+    listing_source_line(l + line_base - 1);
+  }
+    
+}
+#endif
+  demand_empty_rest_of_line();
+  return;
+}                              /* obj_coff_line() */
 
 /*
  *                     def()
@@ -962,18 +976,36 @@ DEFUN_VOID(obj_coff_dim)
     return;
 }                              /* obj_coff_dim() */
 
-static void obj_coff_line() {
-       if (def_symbol_in_progress == NULL) {
-               obj_coff_ln();
-               return;
-       } /* if it looks like a stabs style line */
+static void obj_coff_line() 
+{
+  int this_base;
+  
+  if (def_symbol_in_progress == NULL) {
+      obj_coff_ln();
+      return;
+    }                          /* if it looks like a stabs style line */
 
-       S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1);
-       SA_SET_SYM_LNNO(def_symbol_in_progress, get_absolute_expression());
+  this_base = get_absolute_expression();
+  if (this_base > line_base) 
+  {
+    line_base = this_base;
+  }
+  
+    
+#ifndef NO_LISTING 
+{
+  extern int listing;
+  if (listing && 0) {
+      listing_source_line(line_base);
+    }
+}  
+#endif
+  S_SET_NUMBER_AUXILIARY(def_symbol_in_progress, 1);
+  SA_SET_SYM_LNNO(def_symbol_in_progress, line_base);
 
-       demand_empty_rest_of_line();
-       return;
-} /* obj_coff_line() */
+  demand_empty_rest_of_line();
+  return;
+}                              /* obj_coff_line() */
 
 static void obj_coff_size() {
        if (def_symbol_in_progress == NULL) {
@@ -1816,6 +1848,17 @@ char *filename;
     S_SET_STORAGE_CLASS(symbolP, C_FILE);
     S_SET_NUMBER_AUXILIARY(symbolP, 1);
     SA_SET_FILE_FNAME(symbolP, filename);
+#ifndef NO_LISTING
+  {
+    extern int listing;
+    if (listing) 
+    {
+      listing_source_file(filename);
+    }
+    
+  }
+    
+#endif    
     SF_SET_DEBUG(symbolP);
     S_SET_VALUE(symbolP, (long) previous_file_symbol);
 
index 7a536630ac08a9a5979c484bf251efc471f64f6a..5527181988626d5f00e88095a74a2d676349cd6e 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef OBJ_FORMAT_H
+#define OBJ_FORMAT_H
 /* coff object file format
    Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
 
@@ -511,3 +513,4 @@ extern SCNHDR text_section_header;
  */
 
 /* end of obj-coff.h */
+#endif