Support for @GOTOFF in .long expressions.
[deliverable/binutils-gdb.git] / gas / config / obj-coff.c
index 54c968f1433ce2f3f8efcd33a53463660fadaeac..48056776b70cbb9702f21c118fe137655a055666 100644 (file)
@@ -1,5 +1,6 @@
 /* coff object file format
-   Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GAS.
@@ -220,7 +221,7 @@ obj_coff_weak (ignore)
       *input_line_pointer = c;
       SKIP_WHITESPACE ();
 
-#ifdef BFD_ASSEMBLER
+#if defined BFD_ASSEMBLER || defined S_SET_WEAK
       S_SET_WEAK (symbolP);
 #endif
 
@@ -248,7 +249,7 @@ obj_coff_weak (ignore)
 static void SA_SET_SYM_TAGNDX PARAMS ((symbolS *, symbolS *));
 
 #define GET_FILENAME_STRING(X) \
-((char*)(&((X)->sy_symbol.ost_auxent->x_file.x_n.x_offset))[1])
+((char*) (&((X)->sy_symbol.ost_auxent->x_file.x_n.x_offset))[1])
 
 /* @@ Ick.  */
 static segT
@@ -1434,7 +1435,7 @@ obj_coff_section (ignore)
              switch (*input_line_pointer)
                {
                case 'b': flags |= SEC_ALLOC; flags &=~ SEC_LOAD; break;
-               case 'n': flags &=~ SEC_LOAD; break;
+               case 'n': flags &=~ SEC_LOAD; flags |= SEC_NEVER_LOAD; break;
                case 'd': flags |= SEC_DATA | SEC_LOAD; /* fall through */
                case 'w': flags &=~ SEC_READONLY; break;
                case 'x': flags |= SEC_CODE | SEC_LOAD; break;
@@ -1474,7 +1475,7 @@ obj_coff_section (ignore)
       /* Add SEC_LINK_ONCE and SEC_LINK_DUPLICATES_DISCARD to .gnu.linkonce
          sections so adjust_reloc_syms in write.c will correctly handle
          relocs which refer to non-local symbols in these sections.  */
-      if (strncmp (name, ".gnu.linkonce", sizeof(".gnu.linkonce") - 1) == 0)
+      if (strncmp (name, ".gnu.linkonce", sizeof (".gnu.linkonce") - 1) == 0)
         flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
 #endif
 
@@ -1488,7 +1489,7 @@ obj_coff_section (ignore)
       /* This section's attributes have already been set. Warn if the
          attributes don't match.  */
       flagword matchflags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
-                           | SEC_DATA | SEC_SHARED;
+                         | SEC_DATA | SEC_SHARED | SEC_NEVER_LOAD;
       if ((flags ^ oldflags) & matchflags)
        as_warn (_("Ignoring changed section attributes for %s"), name);
     }
@@ -1626,7 +1627,7 @@ symbol_dump ()
 
   for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
     {
-      printf(_("0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n"),
+      printf (_("0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n"),
             (unsigned long) symbolP,
             S_GET_NAME(symbolP),
             (long) S_GET_DATA_TYPE(symbolP),
@@ -1826,6 +1827,7 @@ size_section (abfd, idx)
          break;
        case rs_align:
        case rs_align_code:
+       case rs_align_test:
          {
            addressT off;
 
@@ -2135,6 +2137,7 @@ fill_section (abfd, h, file_cursor)
                case rs_fill:
                case rs_align:
                case rs_align_code:
+               case rs_align_test:
                case rs_org:
                  if (frag->fr_fix)
                    {
@@ -3443,12 +3446,15 @@ write_object_file ()
       md_do_align (SUB_SEGMENT_ALIGN (now_seg), (char *) NULL, 0, 0,
                   alignment_done);
 #endif
-      frag_align (SUB_SEGMENT_ALIGN (now_seg),
-                 subseg_text_p (now_seg) ? NOP_OPCODE : 0,
-                 0);
+      if (subseg_text_p (now_seg))
+       frag_align_code (SUB_SEGMENT_ALIGN (now_seg), 0);
+      else
+       frag_align (SUB_SEGMENT_ALIGN (now_seg), 0, 0);
+
 #ifdef md_do_align
     alignment_done:
 #endif
+
       frag_wane (frag_now);
       frag_now->fr_fix = 0;
       know (frag_now->fr_next == NULL);
@@ -4051,10 +4057,10 @@ obj_coff_lcomm (ignore)
     }
   *p = 0;
 
-  symbolP = symbol_find_or_make(name);
+  symbolP = symbol_find_or_make (name);
 
-  if (S_GET_SEGMENT(symbolP) == SEG_UNKNOWN &&
-      S_GET_VALUE(symbolP) == 0)
+  if (S_GET_SEGMENT (symbolP) == SEG_UNKNOWN &&
+      S_GET_VALUE (symbolP) == 0)
     {
       if (! need_pass_2)
        {
@@ -4068,14 +4074,14 @@ obj_coff_lcomm (ignore)
                       (offsetT) temp, (char *) 0);
          *p = 0;
          subseg_set (current_seg, current_subseg); /* restore current seg */
-         S_SET_SEGMENT(symbolP, SEG_E2);
-         S_SET_STORAGE_CLASS(symbolP, C_STAT);
+         S_SET_SEGMENT (symbolP, SEG_E2);
+         S_SET_STORAGE_CLASS (symbolP, C_STAT);
        }
     }
   else
-    as_bad(_("Symbol %s already defined"), name);
+    as_bad (_("Symbol %s already defined"), name);
 
-  demand_empty_rest_of_line();
+  demand_empty_rest_of_line ();
 #endif
 }
 
@@ -4092,6 +4098,7 @@ fixup_mdeps (frags, h, this_segment)
        {
        case rs_align:
        case rs_align_code:
+       case rs_align_test:
        case rs_org:
 #ifdef HANDLE_ALIGN
          HANDLE_ALIGN (frags);
@@ -4653,6 +4660,7 @@ const struct format_ops coff_format_ops =
   c_dot_file_symbol,
   coff_frob_symbol,
   0,   /* frob_file */
+  0,   /* frob_file_before_adjust */
   coff_frob_file_after_relocs,
   0,   /* s_get_size */
   0,   /* s_set_size */
This page took 0.025893 seconds and 4 git commands to generate.