* read.c (read_a_source_file): If NO_PSEUDO_DOT is defined, look
[binutils-gdb.git] / gas / config / obj-coffbfd.c
index d2884d376904c1603e84ff3c0c64c1386d6c53c8..9a0a460a5139d5e4b194b997702bedd5bdb0a993 100644 (file)
@@ -1,5 +1,5 @@
 /* coff object file format with bfd
-   Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1991, 1993 Free Software Foundation, Inc.
 
 This file is part of GAS.
 
@@ -68,11 +68,8 @@ const short seg_N_TYPE[] =
   9,
   10,
   C_UNDEF_SECTION,             /* SEG_UNKNOWN */
-  C_UNDEF_SECTION,             /* SEG_ABSENT */
-  C_UNDEF_SECTION,             /* SEG_PASS1 */
   C_UNDEF_SECTION,             /* SEG_GOOF */
-  C_UNDEF_SECTION,             /* SEG_BIG */
-  C_UNDEF_SECTION,             /* SEG_DIFFERENCE */
+  C_UNDEF_SECTION,             /* SEG_EXPR */
   C_DEBUG_SECTION,             /* SEG_DEBUG */
   C_NTV_SECTION,               /* SEG_NTV */
   C_PTV_SECTION,               /* SEG_PTV */
@@ -178,6 +175,10 @@ const pseudo_typeS obj_pseudo_table[] =
   {"ident", obj_coff_ident, 0},
   {"ABORT", s_abort, 0},
   {"lcomm", obj_coff_lcomm, 0},
+#ifdef TC_M88K
+  /* The m88k uses sdef instead of def.  */
+  {"sdef", obj_coff_def, 0},
+#endif
   {NULL}                       /* end sentinel */
 };                             /* obj_pseudo_table */
 
@@ -395,9 +396,11 @@ DEFUN (do_relocs_for, (abfd, h, file_cursor),
                      intr.r_vaddr =
                        base + fix_ptr->fx_frag->fr_address + fix_ptr->fx_where;
 
+#ifdef TC_M88K
                      intr.r_offset = fix_ptr->fx_offset;
-
+#else
                      intr.r_offset = 0;
+#endif
 
                      /* Turn the segment of the symbol into an offset.  */
                      if (symbol_ptr)
@@ -875,6 +878,7 @@ DEFUN (obj_coff_def, (what),
   def_symbol_in_progress->sy_name_offset = ~0;
   def_symbol_in_progress->sy_number = ~0;
   def_symbol_in_progress->sy_frag = &zero_address_frag;
+  S_SET_VALUE (def_symbol_in_progress, 0);
 
   if (S_IS_STRING (def_symbol_in_progress))
     {
@@ -990,7 +994,7 @@ DEFUN_VOID (obj_coff_endef)
       || (S_GET_SEGMENT (def_symbol_in_progress) == SEG_DEBUG
          && !SF_GET_TAG (def_symbol_in_progress))
       || S_GET_SEGMENT (def_symbol_in_progress) == SEG_ABSOLUTE
-      || def_symbol_in_progress->sy_forward != NULL
+      || def_symbol_in_progress->sy_value.X_op != O_constant
       || (symbolP = symbol_find_base (S_GET_NAME (def_symbol_in_progress), DO_NOT_STRIP)) == NULL
       || (SF_GET_TAG (def_symbol_in_progress) != SF_GET_TAG (symbolP)))
     {
@@ -1238,11 +1242,15 @@ obj_coff_val ()
        }
       else if (strcmp (S_GET_NAME (def_symbol_in_progress), symbol_name))
        {
-         def_symbol_in_progress->sy_forward = symbol_find_or_make (symbol_name);
-
-         /* If the segment is undefined when the forward
-                          reference is solved, then copy the segment id
-                          from the forward symbol. */
+         def_symbol_in_progress->sy_value.X_op = O_symbol;
+         def_symbol_in_progress->sy_value.X_add_symbol =
+           symbol_find_or_make (symbol_name);
+         def_symbol_in_progress->sy_value.X_op_symbol = NULL;
+         def_symbol_in_progress->sy_value.X_add_number = 0;
+
+         /* If the segment is undefined when the forward reference is
+            resolved, then copy the segment id from the forward
+            symbol.  */
          SF_SET_GET_SEGMENT (def_symbol_in_progress);
 
          /* FIXME: gcc can generate address expressions
@@ -1369,7 +1377,7 @@ DEFUN_VOID (yank_symbols)
          /* L* and C_EFCN symbols never merge. */
          if (!SF_GET_LOCAL (symbolP)
              && S_GET_STORAGE_CLASS (symbolP) != C_LABEL
-             && symbolP->sy_forward == NULL
+             && symbolP->sy_value.X_op == O_constant
              && (real_symbolP = symbol_find_base (S_GET_NAME (symbolP), DO_NOT_STRIP))
              && real_symbolP != symbolP)
            {
@@ -1396,8 +1404,7 @@ DEFUN_VOID (yank_symbols)
              S_SET_SEGMENT (symbolP, SEG_E0);
            }                   /* push data into text */
 
-         S_SET_VALUE (symbolP,
-                      S_GET_VALUE (symbolP) + symbolP->sy_frag->fr_address);
+         resolve_symbol_value (symbolP);
 
          if (!S_IS_DEFINED (symbolP) && !SF_GET_LOCAL (symbolP))
            {
@@ -1612,16 +1619,6 @@ DEFUN (crawl_symbols, (h, abfd),
   /* Initialize the stack used to keep track of the matching .bb .be */
 
   block_stack = stack_init (512, sizeof (symbolS *));
-  /* JF deal with forward references first... */
-  for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
-    if (symbolP->sy_forward)
-      {
-       S_SET_VALUE (symbolP, (S_GET_VALUE (symbolP)
-                              + S_GET_VALUE (symbolP->sy_forward)
-                              + symbolP->sy_forward->sy_frag->fr_address));
-       if (SF_GET_GET_SEGMENT (symbolP))
-         S_SET_SEGMENT (symbolP, S_GET_SEGMENT (symbolP->sy_forward));
-      }
 
   /* The symbol list should be ordered according to the following sequence
    * order :
@@ -2050,7 +2047,10 @@ obj_coff_text ()
 static void
 obj_coff_data ()
 {
-  change_to_section (".data", 5, get_absolute_expression ());
+  if (flagseen['R'])
+    change_to_section (".text", 5, get_absolute_expression () + 1000);
+  else
+    change_to_section (".data", 5, get_absolute_expression ());
 }
 
 static void
@@ -2532,7 +2532,11 @@ DEFUN (fixup_segment, (segP, this_segment_type),
 
       if (pcrel)
        {
+#ifndef TC_M88K
+         /* This adjustment is not correct on the m88k, for which the
+            linker does all the computation.  */
          add_number -= md_pcrel_from (fixP);
+#endif
          if (add_symbolP == 0)
            {
              fixP->fx_addsy = &abs_symbol;
@@ -2546,6 +2550,9 @@ DEFUN (fixup_segment, (segP, this_segment_type),
 
       if (!fixP->fx_bit_fixP)
        {
+#ifndef TC_M88K
+         /* The m88k uses the offset field of the reloc to get around
+            this problem.  */
          if ((size == 1 &&
          (add_number & ~0xFF) && ((add_number & ~0xFF) != (-1 & ~0xFF))) ||
              (size == 2 &&
@@ -2554,6 +2561,7 @@ DEFUN (fixup_segment, (segP, this_segment_type),
              as_bad ("Value of %d too large for field of %d bytes at 0x%x",
                      add_number, size, fragP->fr_address + where);
            }                   /* generic error checking */
+#endif
 #ifdef WARN_SIGNED_OVERFLOW_WORD
          /* Warn if a .word value is too large when treated as
             a signed number.  We already know it is not too