* ppc.h (R_PPC_RELAX32, R_PPC_RELAX32PC, R_PPC_RELAX32_PLT,
[deliverable/binutils-gdb.git] / gas / write.c
index 9eb17c6597f42e337faf1b61ff3c7dd48517db44..7f4e2d57c782cea7637a376596dc476abf3a26d6 100644 (file)
@@ -1,6 +1,6 @@
 /* write.c - emit .o file
    Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
-   1998, 1999, 2000, 2001, 2002, 2003
+   1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* This thing should be set up to do byteordering correctly.  But...  */
 
@@ -97,9 +97,8 @@
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from (FIX)
 #endif
 
-#ifndef WORKING_DOT_WORD
-extern const int md_short_jump_size;
-extern const int md_long_jump_size;
+#ifndef TC_FAKE_LABEL
+#define TC_FAKE_LABEL(NAME) (strcmp ((NAME), FAKE_LABEL_NAME) == 0)
 #endif
 
 /* Used to control final evaluation of expressions.  */
@@ -112,10 +111,10 @@ symbolS *abs_section_sym;
 /* Remember the value of dot when parsing expressions.  */
 addressT dot_value;
 
-void print_fixup PARAMS ((fixS *));
+void print_fixup (fixS *);
 
 #ifdef BFD_ASSEMBLER
-static void renumber_sections PARAMS ((bfd *, asection *, PTR));
+static void renumber_sections (bfd *, asection *, PTR);
 
 /* We generally attach relocs to frag chains.  However, after we have
    chained these all together into a segment, any relocs we add after
@@ -157,48 +156,46 @@ static int n_fixups;
 #define RELOC_ENUM int
 #endif
 
-static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
-                                      symbolS *add, symbolS *sub,
-                                      offsetT offset, int pcrel,
-                                      RELOC_ENUM r_type));
+static fixS *fix_new_internal (fragS *, int where, int size,
+                              symbolS *add, symbolS *sub,
+                              offsetT offset, int pcrel,
+                              RELOC_ENUM r_type);
 #if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
-static long fixup_segment PARAMS ((fixS *, segT));
+static long fixup_segment (fixS *, segT);
 #endif
-static relax_addressT relax_align PARAMS ((relax_addressT addr, int align));
+static relax_addressT relax_align (relax_addressT addr, int align);
 #if defined (BFD_ASSEMBLER) || ! defined (BFD)
-static fragS *chain_frchains_together_1 PARAMS ((segT, struct frchain *));
+static fragS *chain_frchains_together_1 (segT, struct frchain *);
 #endif
 #ifdef BFD_ASSEMBLER
-static void chain_frchains_together PARAMS ((bfd *, segT, PTR));
-static void cvt_frag_to_fill PARAMS ((segT, fragS *));
-static void adjust_reloc_syms PARAMS ((bfd *, asection *, PTR));
-static void fix_segment PARAMS ((bfd *, asection *, PTR));
-static void write_relocs PARAMS ((bfd *, asection *, PTR));
-static void write_contents PARAMS ((bfd *, asection *, PTR));
-static void set_symtab PARAMS ((void));
+static void chain_frchains_together (bfd *, segT, PTR);
+static void cvt_frag_to_fill (segT, fragS *);
+static void adjust_reloc_syms (bfd *, asection *, PTR);
+static void fix_segment (bfd *, asection *, PTR);
+static void write_relocs (bfd *, asection *, PTR);
+static void write_contents (bfd *, asection *, PTR);
+static void set_symtab (void);
 #endif
 #if defined (BFD_ASSEMBLER) || (! defined (BFD) && ! defined (OBJ_AOUT))
-static void merge_data_into_text PARAMS ((void));
+static void merge_data_into_text (void);
 #endif
 #if ! defined (BFD_ASSEMBLER) && ! defined (BFD)
-static void cvt_frag_to_fill PARAMS ((object_headers *, segT, fragS *));
-static void remove_subsegs PARAMS ((frchainS *, int, fragS **, fragS **));
-static void relax_and_size_all_segments PARAMS ((void));
+static void cvt_frag_to_fill (object_headers *, segT, fragS *);
+static void remove_subsegs (frchainS *, int, fragS **, fragS **);
+static void relax_and_size_all_segments (void);
 #endif
 
 /* Create a fixS in obstack 'notes'.  */
 
 static fixS *
-fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
-                 r_type)
-     fragS *frag;              /* Which frag?  */
-     int where;                        /* Where in that frag?  */
-     int size;                 /* 1, 2, or 4 usually.  */
-     symbolS *add_symbol;      /* X_add_symbol.  */
-     symbolS *sub_symbol;      /* X_op_symbol.  */
-     offsetT offset;           /* X_add_number.  */
-     int pcrel;                        /* TRUE if PC-relative relocation.  */
-     RELOC_ENUM r_type ATTRIBUTE_UNUSED; /* Relocation type.  */
+fix_new_internal (fragS *frag,         /* Which frag?  */
+                 int where,            /* Where in that frag?  */
+                 int size,             /* 1, 2, or 4 usually.  */
+                 symbolS *add_symbol,  /* X_add_symbol.  */
+                 symbolS *sub_symbol,  /* X_op_symbol.  */
+                 offsetT offset,       /* X_add_number.  */
+                 int pcrel,            /* TRUE if PC-relative relocation.  */
+                 RELOC_ENUM r_type ATTRIBUTE_UNUSED /* Relocation type.  */)
 {
   fixS *fixP;
 
@@ -283,14 +280,13 @@ fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
 /* Create a fixup relative to a symbol (plus a constant).  */
 
 fixS *
-fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
-     fragS *frag;              /* Which frag?  */
-     int where;                        /* Where in that frag?  */
-     int size;                 /* 1, 2, or 4 usually.  */
-     symbolS *add_symbol;      /* X_add_symbol.  */
-     offsetT offset;           /* X_add_number.  */
-     int pcrel;                        /* TRUE if PC-relative relocation.  */
-     RELOC_ENUM r_type;                /* Relocation type.  */
+fix_new (fragS *frag,          /* Which frag?  */
+        int where,                     /* Where in that frag?  */
+        int size,                      /* 1, 2, or 4 usually.  */
+        symbolS *add_symbol,   /* X_add_symbol.  */
+        offsetT offset,                /* X_add_number.  */
+        int pcrel,                     /* TRUE if PC-relative relocation.  */
+        RELOC_ENUM r_type              /* Relocation type.  */)
 {
   return fix_new_internal (frag, where, size, add_symbol,
                           (symbolS *) NULL, offset, pcrel, r_type);
@@ -301,13 +297,12 @@ fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
    file formats support anyhow.  */
 
 fixS *
-fix_new_exp (frag, where, size, exp, pcrel, r_type)
-     fragS *frag;              /* Which frag?  */
-     int where;                        /* Where in that frag?  */
-     int size;                 /* 1, 2, or 4 usually.  */
-     expressionS *exp;         /* Expression.  */
-     int pcrel;                        /* TRUE if PC-relative relocation.  */
-     RELOC_ENUM r_type;                /* Relocation type.  */
+fix_new_exp (fragS *frag,              /* Which frag?  */
+            int where,                 /* Where in that frag?  */
+            int size,                  /* 1, 2, or 4 usually.  */
+            expressionS *exp,          /* Expression.  */
+            int pcrel,                 /* TRUE if PC-relative relocation.  */
+            RELOC_ENUM r_type          /* Relocation type.  */)
 {
   symbolS *add = NULL;
   symbolS *sub = NULL;
@@ -376,8 +371,7 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type)
 
 /* Generic function to determine whether a fixup requires a relocation.  */
 int
-generic_force_reloc (fix)
-     fixS *fix;
+generic_force_reloc (fixS *fix)
 {
 #ifdef BFD_ASSEMBLER
   if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
@@ -389,10 +383,7 @@ generic_force_reloc (fix)
 
 /* Append a string onto another string, bumping the pointer along.  */
 void
-append (charPP, fromP, length)
-     char **charPP;
-     char *fromP;
-     unsigned long length;
+append (char **charPP, char *fromP, unsigned long length)
 {
   /* Don't trust memcpy() of 0 chars.  */
   if (length == 0)
@@ -412,12 +403,11 @@ int section_alignment[SEG_MAXIMUM_ORDINAL];
    least one object format really uses this info.  */
 
 void
-record_alignment (seg, align)
-     /* Segment to which alignment pertains.  */
-     segT seg;
-     /* Alignment, as a power of 2 (e.g., 1 => 2-byte boundary, 2 => 4-byte
-       boundary, etc.)  */
-     int align;
+record_alignment (/* Segment to which alignment pertains.  */
+                 segT seg,
+                 /* Alignment, as a power of 2 (e.g., 1 => 2-byte
+                    boundary, 2 => 4-byte boundary, etc.)  */
+                 int align)
 {
   if (seg == absolute_section)
     return;
@@ -431,8 +421,7 @@ record_alignment (seg, align)
 }
 
 int
-get_recorded_alignment (seg)
-     segT seg;
+get_recorded_alignment (segT seg)
 {
   if (seg == absolute_section)
     return 0;
@@ -448,10 +437,7 @@ get_recorded_alignment (seg)
 /* Reset the section indices after removing the gas created sections.  */
 
 static void
-renumber_sections (abfd, sec, countparg)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *sec;
-     PTR countparg;
+renumber_sections (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, PTR countparg)
 {
   int *countp = (int *) countparg;
 
@@ -464,9 +450,7 @@ renumber_sections (abfd, sec, countparg)
 #if defined (BFD_ASSEMBLER) || ! defined (BFD)
 
 static fragS *
-chain_frchains_together_1 (section, frchp)
-     segT section;
-     struct frchain *frchp;
+chain_frchains_together_1 (segT section, struct frchain *frchp)
 {
   fragS dummy, *prev_frag = &dummy;
 #ifdef BFD_ASSEMBLER
@@ -499,10 +483,9 @@ chain_frchains_together_1 (section, frchp)
 #ifdef BFD_ASSEMBLER
 
 static void
-chain_frchains_together (abfd, section, xxx)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     segT section;
-     PTR xxx ATTRIBUTE_UNUSED;
+chain_frchains_together (bfd *abfd ATTRIBUTE_UNUSED,
+                        segT section,
+                        PTR xxx ATTRIBUTE_UNUSED)
 {
   segment_info_type *info;
 
@@ -523,11 +506,7 @@ chain_frchains_together (abfd, section, xxx)
 #if !defined (BFD) && !defined (BFD_ASSEMBLER)
 
 static void
-remove_subsegs (head, seg, root, last)
-     frchainS *head;
-     int seg;
-     fragS **root;
-     fragS **last;
+remove_subsegs (frchainS *head, int seg, fragS **root, fragS **last)
 {
   *root = head->frch_root;
   *last = chain_frchains_together_1 (seg, head);
@@ -539,15 +518,10 @@ remove_subsegs (head, seg, root, last)
 
 #ifdef BFD_ASSEMBLER
 static void
-cvt_frag_to_fill (sec, fragP)
-     segT sec ATTRIBUTE_UNUSED;
-     fragS *fragP;
+cvt_frag_to_fill (segT sec ATTRIBUTE_UNUSED, fragS *fragP)
 #else
 static void
-cvt_frag_to_fill (headersP, sec, fragP)
-     object_headers *headersP;
-     segT sec;
-     fragS *fragP;
+cvt_frag_to_fill (object_headers *headersP, segT sec, fragS *fragP)
 #endif
 {
   switch (fragP->fr_type)
@@ -641,17 +615,18 @@ cvt_frag_to_fill (headersP, sec, fragP)
       BAD_CASE (fragP->fr_type);
       break;
     }
+#ifdef md_frag_check
+  md_frag_check (fragP);
+#endif
 }
 
 #endif /* defined (BFD_ASSEMBLER) || !defined (BFD)  */
 
 #ifdef BFD_ASSEMBLER
-static void relax_seg PARAMS ((bfd *, asection *, PTR));
+static void relax_seg (bfd *, asection *, PTR);
+
 static void
-relax_seg (abfd, sec, xxx)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *sec;
-     PTR xxx;
+relax_seg (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, PTR xxx)
 {
   segment_info_type *seginfo = seg_info (sec);
 
@@ -663,12 +638,10 @@ relax_seg (abfd, sec, xxx)
     }
 }
 
-static void size_seg PARAMS ((bfd *, asection *, PTR));
+static void size_seg (bfd *, asection *, PTR);
+
 static void
-size_seg (abfd, sec, xxx)
-     bfd *abfd;
-     asection *sec;
-     PTR xxx ATTRIBUTE_UNUSED;
+size_seg (bfd *abfd, asection *sec, PTR xxx ATTRIBUTE_UNUSED)
 {
   flagword flags;
   fragS *fragp;
@@ -781,10 +754,9 @@ dump_section_relocs (abfd, sec, stream_)
    section symbols.  */
 
 static void
-adjust_reloc_syms (abfd, sec, xxx)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *sec;
-     PTR xxx ATTRIBUTE_UNUSED;
+adjust_reloc_syms (bfd *abfd ATTRIBUTE_UNUSED,
+                  asection *sec,
+                  PTR xxx ATTRIBUTE_UNUSED)
 {
   segment_info_type *seginfo = seg_info (sec);
   fixS *fixp;
@@ -819,12 +791,20 @@ adjust_reloc_syms (abfd, sec, xxx)
        if (fixp->fx_subsy != NULL)
          resolve_symbol_value (fixp->fx_subsy);
 
-       /* If this symbol is equated to an undefined symbol, convert
-           the fixup to being against that symbol.  */
+       /* If this symbol is equated to an undefined or common symbol,
+          convert the fixup to being against that symbol.  */
        if (symbol_equated_reloc_p (sym))
          {
+           symbolS *new_sym
+             = symbol_get_value_expression (sym)->X_add_symbol;
+           const char *name = S_GET_NAME (sym);
+           if (!S_IS_COMMON (new_sym)
+               && !TC_FAKE_LABEL (name)
+               && (!S_IS_EXTERNAL (sym) || S_IS_LOCAL (sym)))
+             as_bad (_("Local symbol `%s' can't be equated to undefined symbol `%s'"),
+                     name, S_GET_NAME (new_sym));
            fixp->fx_offset += symbol_get_value_expression (sym)->X_add_number;
-           sym = symbol_get_value_expression (sym)->X_add_symbol;
+           sym = new_sym;
            fixp->fx_addsy = sym;
          }
 
@@ -904,10 +884,9 @@ adjust_reloc_syms (abfd, sec, xxx)
 }
 
 static void
-fix_segment (abfd, sec, xxx)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *sec;
-     PTR xxx ATTRIBUTE_UNUSED;
+fix_segment (bfd *abfd ATTRIBUTE_UNUSED,
+            asection *sec,
+            PTR xxx ATTRIBUTE_UNUSED)
 {
   segment_info_type *seginfo = seg_info (sec);
 
@@ -915,10 +894,7 @@ fix_segment (abfd, sec, xxx)
 }
 
 static void
-write_relocs (abfd, sec, xxx)
-     bfd *abfd;
-     asection *sec;
-     PTR xxx ATTRIBUTE_UNUSED;
+write_relocs (bfd *abfd, asection *sec, PTR xxx ATTRIBUTE_UNUSED)
 {
   segment_info_type *seginfo = seg_info (sec);
   unsigned int i;
@@ -978,12 +954,12 @@ write_relocs (abfd, sec, xxx)
          continue;
        }
 
-#if 0
-      /* This test is triggered inappropriately for the SH.  */
-      if (fixp->fx_where + fixp->fx_size
-         > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
-       abort ();
-#endif
+      /*
+       This test is triggered inappropriately for the SH:
+         if (fixp->fx_where + fixp->fx_size
+            > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
+            abort ();
+      */
 
       s = bfd_install_relocation (stdoutput, reloc,
                                  fixp->fx_frag->fr_literal,
@@ -1129,10 +1105,9 @@ write_relocs (abfd, sec, xxx)
 }
 
 static void
-write_contents (abfd, sec, xxx)
-     bfd *abfd ATTRIBUTE_UNUSED;
-     asection *sec;
-     PTR xxx ATTRIBUTE_UNUSED;
+write_contents (bfd *abfd ATTRIBUTE_UNUSED,
+               asection *sec,
+               PTR xxx ATTRIBUTE_UNUSED)
 {
   segment_info_type *seginfo = seg_info (sec);
   addressT offset = 0;
@@ -1228,7 +1203,7 @@ write_contents (abfd, sec, xxx)
 
 #if defined(BFD_ASSEMBLER) || (!defined (BFD) && !defined(OBJ_AOUT))
 static void
-merge_data_into_text ()
+merge_data_into_text (void)
 {
 #if defined(BFD_ASSEMBLER) || defined(MANY_SEGMENTS)
   seg_info (text_section)->frchainP->frch_last->fr_next =
@@ -1345,13 +1320,13 @@ relax_and_size_all_segments ()
 
 #ifdef BFD_ASSEMBLER
 static void
-set_symtab ()
+set_symtab (void)
 {
   int nsyms;
   asymbol **asympp;
   symbolS *symp;
   bfd_boolean result;
-  extern PTR bfd_alloc PARAMS ((bfd *, bfd_size_type));
+  extern PTR bfd_alloc (bfd *, bfd_size_type);
 
   /* Count symbols.  We can't rely on a count made by the loop in
      write_object_file, because *_frob_file may add a new symbol or
@@ -1389,7 +1364,7 @@ set_symtab ()
 
 #ifndef SUB_SEGMENT_ALIGN
 #ifdef HANDLE_ALIGN
-/* The last subsegment gets an aligment corresponding to the alignment
+/* The last subsegment gets an alignment corresponding to the alignment
    of the section.  This allows proper nop-filling at the end of
    code-bearing sections.  */
 #define SUB_SEGMENT_ALIGN(SEG, FRCHAIN)                                        \
@@ -1405,7 +1380,7 @@ set_symtab ()
 #endif
 
 void
-subsegs_finish ()
+subsegs_finish (void)
 {
   struct frchain *frchainP;
 
@@ -1458,7 +1433,7 @@ subsegs_finish ()
 /* Write the object file.  */
 
 void
-write_object_file ()
+write_object_file (void)
 {
 #if ! defined (BFD_ASSEMBLER) || ! defined (WORKING_DOT_WORD)
   fragS *fragP;                        /* Track along all frags.  */
@@ -1500,20 +1475,11 @@ write_object_file ()
 #ifdef BFD_ASSEMBLER
   /* Remove the sections created by gas for its own purposes.  */
   {
-    asection **seclist;
     int i;
 
-    seclist = &stdoutput->sections;
-    while (*seclist)
-      {
-       if (*seclist == reg_section || *seclist == expr_section)
-         {
-           bfd_section_list_remove (stdoutput, seclist);
-           stdoutput->section_count--;
-         }
-       else
-         seclist = &(*seclist)->next;
-      }
+    bfd_section_list_remove (stdoutput, reg_section);
+    bfd_section_list_remove (stdoutput, expr_section);
+    stdoutput->section_count -= 2;
     i = 0;
     bfd_map_over_sections (stdoutput, renumber_sections, &i);
   }
@@ -1606,11 +1572,11 @@ write_object_file ()
      Count the number of string-table chars we will emit.
      Put this info into the headers as appropriate.  */
   know (zero_address_frag.fr_address == 0);
-  string_byte_count = sizeof (string_byte_count);
+  string_byte_count = 4;
 
   obj_crawl_symbol_chain (&headers);
 
-  if (string_byte_count == sizeof (string_byte_count))
+  if (string_byte_count == 4)
     string_byte_count = 0;
 
   H_SET_STRING_SIZE (&headers, string_byte_count);
@@ -1919,12 +1885,22 @@ write_object_file ()
   if (symbol_rootP)
     {
       symbolS *symp;
+      bfd_boolean skip_next_symbol = FALSE;
 
       for (symp = symbol_rootP; symp; symp = symbol_next (symp))
        {
          int punt = 0;
          const char *name;
 
+         if (skip_next_symbol)
+           {
+             /* Don't do anything besides moving the value of the
+                symbol from the GAS value-field to the BFD value-field.  */
+             symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
+             skip_next_symbol = FALSE;
+             continue;
+           }
+
          if (symbol_mri_common_p (symp))
            {
              if (S_IS_EXTERNAL (symp))
@@ -1954,6 +1930,15 @@ write_object_file ()
              symbols.  */
          if (symbol_equated_reloc_p (symp))
            {
+             const char *name = S_GET_NAME (symp);
+             if (S_IS_COMMON (symp)
+                 && !TC_FAKE_LABEL (name)
+                 && (!S_IS_EXTERNAL (symp) || S_IS_LOCAL (symp)))
+               {
+                 expressionS *e = symbol_get_value_expression (symp);
+                 as_bad (_("Local symbol `%s' can't be equated to common symbol `%s'"),
+                         name, S_GET_NAME (e->X_add_symbol));
+               }
              symbol_remove (symp, &symbol_rootP, &symbol_lastP);
              continue;
            }
@@ -1963,13 +1948,6 @@ write_object_file ()
          if (S_IS_DEFINED (symp) == 0
              && S_GET_VALUE (symp) != 0)
            S_SET_SEGMENT (symp, bfd_com_section_ptr);
-#if 0
-         printf ("symbol `%s'\n\t@%x: value=%d flags=%x seg=%s\n",
-                 S_GET_NAME (symp), symp,
-                 S_GET_VALUE (symp),
-                 symbol_get_bfdsym (symp)->flags,
-                 segment_name (S_GET_SEGMENT (symp)));
-#endif
 
 #ifdef obj_frob_symbol
          obj_frob_symbol (symp, punt);
@@ -1987,10 +1965,10 @@ write_object_file ()
          if (symp == abs_section_sym
              || (! EMIT_SECTION_SYMBOLS
                  && symbol_section_p (symp))
-             /* Note that S_IS_EXTERN and S_IS_LOCAL are not always
+             /* Note that S_IS_EXTERNAL and S_IS_LOCAL are not always
                 opposites.  Sometimes the former checks flags and the
                 latter examines the name...  */
-             || (!S_IS_EXTERN (symp)
+             || (!S_IS_EXTERNAL (symp)
                  && (punt || S_IS_LOCAL (symp))
                  && ! symbol_used_in_reloc_p (symp)))
            {
@@ -2013,6 +1991,12 @@ write_object_file ()
          /* Set the value into the BFD symbol.  Up til now the value
             has only been kept in the gas symbolS struct.  */
          symbol_get_bfdsym (symp)->value = S_GET_VALUE (symp);
+
+         /* A warning construct is a warning symbol followed by the
+            symbol warned about.  Don't let anything object-format or
+            target-specific muck with it; it's ready for output.  */
+         if (symbol_get_bfdsym (symp)->flags & BSF_WARNING)
+           skip_next_symbol = TRUE;
        }
     }
 
@@ -2061,10 +2045,7 @@ write_object_file ()
 /* Relax a fragment by scanning TC_GENERIC_RELAX_TABLE.  */
 
 long
-relax_frag (segment, fragP, stretch)
-     segT segment;
-     fragS *fragP;
-     long stretch;
+relax_frag (segT segment, fragS *fragP, long stretch)
 {
   const relax_typeS *this_type;
   const relax_typeS *start_type;
@@ -2120,14 +2101,10 @@ relax_frag (segment, fragP, stretch)
 #ifdef TC_PCREL_ADJUST
   /* Currently only the ns32k family needs this.  */
   aim += TC_PCREL_ADJUST (fragP);
-/* #else */
-  /* This machine doesn't want to use pcrel_adjust.
-     In that case, pcrel_adjust should be zero.  */
-#if 0
-  assert (fragP->fr_targ.ns32k.pcrel_adjust == 0);
 #endif
-#endif
-#ifdef md_prepare_relax_scan /* formerly called M68K_AIM_KLUDGE  */
+
+#ifdef md_prepare_relax_scan
+  /* Formerly called M68K_AIM_KLUDGE.  */
   md_prepare_relax_scan (fragP, address, aim, this_state, this_type);
 #endif
 
@@ -2171,9 +2148,8 @@ relax_frag (segment, fragP, stretch)
 /* Relax_align. Advance location counter to next address that has 'alignment'
    lowest order bits all 0s, return size of adjustment made.  */
 static relax_addressT
-relax_align (address, alignment)
-     register relax_addressT address;  /* Address now.  */
-     register int alignment;   /* Alignment (binary).  */
+relax_align (register relax_addressT address,  /* Address now.  */
+            register int alignment     /* Alignment (binary).  */)
 {
   relax_addressT mask;
   relax_addressT new_address;
@@ -2200,9 +2176,7 @@ relax_align (address, alignment)
    addresses.  */
 
 int
-relax_segment (segment_frag_root, segment)
-     struct frag *segment_frag_root;
-     segT segment;
+relax_segment (struct frag *segment_frag_root, segT segment)
 {
   register struct frag *fragP;
   register relax_addressT address;
@@ -2430,7 +2404,9 @@ relax_segment (segment_frag_root, segment)
                          into the section.  Here it is assumed that the
                          section's VMA is zero, and can omit subtracting it
                          from the symbol's value to get the address offset.  */
-                      know (S_GET_SECTION (symbolP)->vma == 0);
+#ifdef BFD_ASSEMBLER
+                      know (S_GET_SEGMENT (symbolP)->vma == 0);
+#endif
                      target += S_GET_VALUE (symbolP) * OCTETS_PER_BYTE;
                    }
 
@@ -2450,7 +2426,7 @@ relax_segment (segment_frag_root, segment)
                      fragP->fr_type = rs_align;
                      fragP->fr_subtype = 0;
                      fragP->fr_offset = 0;
-                     fragP->fr_fix = after - address;
+                     fragP->fr_fix = after - was_address;
                      growth = stretch;
                    }
 
@@ -2557,9 +2533,7 @@ relax_segment (segment_frag_root, segment)
    These will be output later by emit_relocations().  */
 
 static long
-fixup_segment (fixP, this_segment)
-     fixS *fixP;
-     segT this_segment;
+fixup_segment (fixS *fixP, segT this_segment)
 {
   long seg_reloc_count = 0;
   valueT add_number;
@@ -2620,7 +2594,6 @@ fixup_segment (fixP, this_segment)
       if (fixP->fx_addsy != NULL
          && symbol_mri_common_p (fixP->fx_addsy))
        {
-         know (fixP->fx_addsy->sy_value.X_op == O_symbol);
          add_number += S_GET_VALUE (fixP->fx_addsy);
          fixP->fx_offset = add_number;
          fixP->fx_addsy
@@ -2799,10 +2772,7 @@ fixup_segment (fixP, this_segment)
 #endif /* defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS)) */
 
 void
-number_to_chars_bigendian (buf, val, n)
-     char *buf;
-     valueT val;
-     int n;
+number_to_chars_bigendian (char *buf, valueT val, int n)
 {
   if (n <= 0)
     abort ();
@@ -2814,10 +2784,7 @@ number_to_chars_bigendian (buf, val, n)
 }
 
 void
-number_to_chars_littleendian (buf, val, n)
-     char *buf;
-     valueT val;
-     int n;
+number_to_chars_littleendian (char *buf, valueT val, int n)
 {
   if (n <= 0)
     abort ();
@@ -2829,8 +2796,7 @@ number_to_chars_littleendian (buf, val, n)
 }
 
 void
-write_print_statistics (file)
-     FILE *file;
+write_print_statistics (FILE *file)
 {
   fprintf (file, "fixups: %d\n", n_fixups);
 }
@@ -2839,8 +2805,7 @@ write_print_statistics (file)
 extern int indent_level;
 
 void
-print_fixup (fixp)
-     fixS *fixp;
+print_fixup (fixS *fixp)
 {
   indent_level = 1;
   fprintf (stderr, "fix %lx %s:%d", (long) fixp, fixp->fx_file, fixp->fx_line);
This page took 0.033932 seconds and 4 git commands to generate.