2001-01-14 Kazu Hirata <kazu@hxi.com>
[deliverable/binutils-gdb.git] / gas / config / tc-alpha.c
index 75b9a577902f7c091c28720c8f4466584344bd15..ee9e220e5c5a1b085c1cd5138419ad2e918fdc4b 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU.
-   Copyright (C) 1989, 93-98, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1989, 93-98, 1999, 2000, 2001 Free Software Foundation, Inc.
    Contributed by Carnegie Mellon University, 1993.
    Written by Alessandro Forin, based on earlier gas-1.38 target CPU files.
    Modified by Ken Raeburn for gas-2.x and ECOFF support.
@@ -58,6 +58,7 @@
 
 #ifdef OBJ_ELF
 #include "elf/alpha.h"
+#include "dwarf2dbg.h"
 #endif
 
 #include <ctype.h>
@@ -108,7 +109,7 @@ struct alpha_macro
   enum alpha_macro_arg argsets[16];
 };
 
-/* Extra expression types. */
+/* Extra expression types.  */
 
 #define O_pregister    O_md1   /* O_register, in parentheses */
 #define O_cpregister   O_md2   /* + a leading comma */
@@ -127,7 +128,6 @@ struct alpha_macro
 #define USER_RELOC_P(R) ((R) >= O_literal && (R) <= O_gprellow)
 #endif
 
-
 /* Macros for extracting the type and number of encoded register tokens */
 
 #define is_ir_num(x)           (((x) & 32) == 0)
@@ -145,14 +145,14 @@ struct alpha_macro
 
 #if 1
 #define range_signed_16(x) \
-       (((offsetT)(x) >> 15) == 0 || ((offsetT)(x) >> 15) == -1)
+       (((offsetT) (x) >> 15) == 0 || ((offsetT) (x) >> 15) == -1)
 #define range_signed_32(x) \
-       (((offsetT)(x) >> 31) == 0 || ((offsetT)(x) >> 31) == -1)
+       (((offsetT) (x) >> 31) == 0 || ((offsetT) (x) >> 31) == -1)
 #else
-#define range_signed_16(x)     ((offsetT)(x) >= -(offsetT)0x8000 &&    \
-                                (offsetT)(x) <=  (offsetT)0x7FFF)
-#define range_signed_32(x)     ((offsetT)(x) >= -(offsetT)0x80000000 && \
-                                (offsetT)(x) <=  (offsetT)0x7FFFFFFF)
+#define range_signed_16(x)     ((offsetT) (x) >= -(offsetT)0x8000 &&   \
+                                (offsetT) (x) <=  (offsetT)0x7FFF)
+#define range_signed_32(x)     ((offsetT) (x) >= -(offsetT)0x80000000 && \
+                                (offsetT) (x) <=  (offsetT)0x7FFFFFFF)
 #endif
 
 /* Macros for sign extending from 16- and 32-bits.  */
@@ -160,33 +160,33 @@ struct alpha_macro
    but really a predicate should be found to use the non-cast forms.  */
 
 #if 1
-#define sign_extend_16(x)      ((short)(x))
-#define sign_extend_32(x)      ((int)(x))
+#define sign_extend_16(x)      ((short) (x))
+#define sign_extend_32(x)      ((int) (x))
 #else
-#define sign_extend_16(x)      ((offsetT)(((x) & 0xFFFF) ^ 0x8000) - 0x8000)
-#define sign_extend_32(x)      ((offsetT)(((x) & 0xFFFFFFFF) \
+#define sign_extend_16(x)      ((offsetT) (((x) & 0xFFFF) ^ 0x8000) - 0x8000)
+#define sign_extend_32(x)      ((offsetT) (((x) & 0xFFFFFFFF) \
                                           ^ 0x80000000) - 0x80000000)
 #endif
 
 /* Macros to build tokens */
 
-#define set_tok_reg(t, r)      (memset(&(t), 0, sizeof(t)),            \
+#define set_tok_reg(t, r)      (memset(&(t), 0, sizeof (t)),           \
                                 (t).X_op = O_register,                 \
                                 (t).X_add_number = (r))
-#define set_tok_preg(t, r)     (memset(&(t), 0, sizeof(t)),            \
+#define set_tok_preg(t, r)     (memset(&(t), 0, sizeof (t)),           \
                                 (t).X_op = O_pregister,                \
                                 (t).X_add_number = (r))
-#define set_tok_cpreg(t, r)    (memset(&(t), 0, sizeof(t)),            \
+#define set_tok_cpreg(t, r)    (memset(&(t), 0, sizeof (t)),           \
                                 (t).X_op = O_cpregister,               \
                                 (t).X_add_number = (r))
-#define set_tok_freg(t, r)     (memset(&(t), 0, sizeof(t)),            \
+#define set_tok_freg(t, r)     (memset(&(t), 0, sizeof (t)),           \
                                 (t).X_op = O_register,                 \
                                 (t).X_add_number = (r)+32)
-#define set_tok_sym(t, s, a)   (memset(&(t), 0, sizeof(t)),            \
+#define set_tok_sym(t, s, a)   (memset(&(t), 0, sizeof (t)),           \
                                 (t).X_op = O_symbol,                   \
                                 (t).X_add_symbol = (s),                \
                                 (t).X_add_number = (a))
-#define set_tok_const(t, n)    (memset(&(t), 0, sizeof(t)),            \
+#define set_tok_const(t, n)    (memset(&(t), 0, sizeof (t)),           \
                                 (t).X_op = O_constant,                 \
                                 (t).X_add_number = (n))
 
@@ -246,6 +246,9 @@ static void s_alpha_end PARAMS ((int));
 static void s_alpha_mask PARAMS ((int));
 static void s_alpha_frame PARAMS ((int));
 static void s_alpha_prologue PARAMS ((int));
+static void s_alpha_file PARAMS ((int));
+static void s_alpha_loc PARAMS ((int));
+static void s_alpha_stab PARAMS ((int));
 static void s_alpha_coff_wrapper PARAMS ((int));
 #endif
 #ifdef OBJ_EVAX
@@ -317,7 +320,7 @@ struct option md_longopts[] = {
   { NULL, no_argument, NULL, 0 }
 };
 
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
 
 \f
 #ifdef OBJ_EVAX
@@ -376,7 +379,7 @@ static segT alpha_dtors_section;
 #endif
 static segT alpha_lit8_section;
 
-/* Symbols referring to said sections. */
+/* Symbols referring to said sections.  */
 #ifdef OBJ_ECOFF
 static symbolS *alpha_lita_symbol;
 static symbolS *alpha_lit4_symbol;
@@ -394,8 +397,8 @@ static offsetT alpha_lit4_literal;
 static offsetT alpha_lit8_literal;
 #endif
 
-/* The active .ent symbol.  */
 #ifdef OBJ_ELF
+/* The active .ent symbol.  */
 static symbolS *alpha_cur_ent_sym;
 #endif
 
@@ -433,7 +436,7 @@ static int alpha_debug;
 
 #ifdef OBJ_ELF
 /* Whether we are emitting an mdebug section.  */
-int alpha_flag_mdebug = 1;
+int alpha_flag_mdebug = -1;
 #endif
 
 /* Don't fully resolve relocations, allowing code movement in the linker.  */
@@ -475,7 +478,7 @@ static int alpha_flag_show_after_trunc = 0;         /* -H */
 #define ALPHA_RELOC_TABLE(op)                                          \
 &alpha_reloc_op[ ((!USER_RELOC_P (op))                                 \
                  ? (abort (), 0)                                       \
-                 : (int)(op) - (int)O_literal) ]
+                 : (int) (op) - (int)O_literal) ]
 
 #define LITUSE_BASE    1
 #define LITUSE_BYTOFF  2
@@ -547,13 +550,13 @@ static const struct alpha_reloc_op_tag {
 };
 
 static const int alpha_num_reloc_op
-  = sizeof(alpha_reloc_op) / sizeof(*alpha_reloc_op);
+  = sizeof (alpha_reloc_op) / sizeof (*alpha_reloc_op);
 
 /* Maximum # digits needed to hold the largest sequence # */
 #define ALPHA_RELOC_DIGITS 25
 
 /* Whether a sequence number is valid.  */
-#define ALPHA_RELOC_SEQUENCE_OK(X) ((X) > 0 && ((unsigned)(X)) == (X))
+#define ALPHA_RELOC_SEQUENCE_OK(X) ((X) > 0 && ((unsigned) (X)) == (X))
 
 /* Structure to hold explict sequence information.  */
 struct alpha_literal_tag
@@ -580,7 +583,7 @@ static const struct cpu_type
 } cpu_types[] =
 {
   /* Ad hoc convention: cpu number gets palcode, process code doesn't.
-     This supports usage under DU 4.0b that does ".arch ev4", and 
+     This supports usage under DU 4.0b that does ".arch ev4", and
      usage in MILO that does -m21064.  Probably something more
      specific like -m21064-pal should be used, but oh well.  */
 
@@ -801,7 +804,7 @@ static const struct alpha_macro alpha_macros[] = {
 };
 
 static const unsigned int alpha_num_macros
-  = sizeof(alpha_macros) / sizeof(*alpha_macros);
+  = sizeof (alpha_macros) / sizeof (*alpha_macros);
 \f
 /* Public interface functions */
 
@@ -878,14 +881,14 @@ md_begin ()
   for (i = 0; i < 32; ++i)
     {
       char name[4];
-      sprintf(name, "$%d", i);
+      sprintf (name, "$%d", i);
       alpha_register_table[i] = symbol_create(name, reg_section, i,
                                              &zero_address_frag);
     }
   for (; i < 64; ++i)
     {
       char name[5];
-      sprintf(name, "$f%d", i-32);
+      sprintf (name, "$f%d", i-32);
       alpha_register_table[i] = symbol_create(name, reg_section, i,
                                              &zero_address_frag);
     }
@@ -937,7 +940,7 @@ md_assemble (str)
   size_t opnamelen;
 
   /* split off the opcode */
-  opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/468");
+  opnamelen = strspn (str, "abcdefghijklmnopqrstuvwxyz_/46819");
   trunclen = (opnamelen < sizeof (opname) - 1
              ? opnamelen
              : sizeof (opname) - 1);
@@ -971,8 +974,8 @@ md_section_align (seg, size)
 }
 
 /* Turn a string in input_line_pointer into a floating point constant
-   of type type, and store the appropriate bytes in *litP.  The number
-   of LITTLENUMS emitted is stored in *sizeP.  An error message is
+   of type TYPE, and store the appropriate bytes in *LITP.  The number
+   of LITTLENUMS emitted is stored in *SIZEP.  An error message is
    returned, or NULL on OK.  */
 
 /* Equal to MAX_PRECISION in atof-ieee.c */
@@ -1078,7 +1081,7 @@ md_parse_option (c, arg)
       break;
 
 #ifdef OBJ_EVAX
-    case '+':                  /* For g++.  Hash any name > 63 chars long. */
+    case '+':                  /* For g++.  Hash any name > 63 chars long.  */
       alpha_flag_hash_long_names = 1;
       break;
 
@@ -1290,6 +1293,10 @@ md_apply_fix (fixP, valueP)
       abort ();
 #endif
 
+    case BFD_RELOC_VTABLE_INHERIT:
+    case BFD_RELOC_VTABLE_ENTRY:
+      return 1;
+
     default:
       {
        const struct alpha_operand *operand;
@@ -1372,7 +1379,7 @@ md_undefined_symbol(name)
          else
            break;
 
-         if (!alpha_noat_on && num == AXP_REG_AT)
+         if (!alpha_noat_on && (num + is_float) == AXP_REG_AT)
            as_warn(_("Used $at without \".set noat\""));
          return alpha_register_table[num + is_float];
 
@@ -1459,6 +1466,8 @@ alpha_force_relocation (f)
     case BFD_RELOC_ALPHA_USER_GPRELHIGH:
     case BFD_RELOC_ALPHA_USER_GPRELLOW:
 #endif
+    case BFD_RELOC_VTABLE_INHERIT:
+    case BFD_RELOC_VTABLE_ENTRY:
       return 1;
 
     case BFD_RELOC_23_PCREL_S2:
@@ -1518,6 +1527,8 @@ alpha_fix_adjustable (f)
     case BFD_RELOC_ALPHA_USER_GPRELHIGH:
     case BFD_RELOC_ALPHA_USER_GPRELLOW:
 #endif
+    case BFD_RELOC_VTABLE_ENTRY:
+    case BFD_RELOC_VTABLE_INHERIT:
       return 0;
 
     case BFD_RELOC_GPREL32:
@@ -1672,9 +1683,9 @@ alpha_adjust_symtab ()
 
 static void
 alpha_adjust_symtab_relocs (abfd, sec, ptr)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
-     PTR ptr;
+     PTR ptr ATTRIBUTE_UNUSED;
 {
   segment_info_type *seginfo = seg_info (sec);
   fixS **prevP;
@@ -2002,7 +2013,7 @@ tokenize_arguments (str, tok, ntok)
          {
            char *hold = input_line_pointer++;
 
-           /* First try for parenthesized register ... */
+           /* First try for parenthesized register ...  */
            expression (tok);
            if (*input_line_pointer == ')' && tok->X_op == O_register)
              {
@@ -2139,7 +2150,7 @@ find_opcode_match(first_opcode, tok, pntok, pcpumatch)
 
            default:
              /* everything else should have been fake */
-             abort();
+             abort ();
            }
          ++tokidx;
        }
@@ -2407,7 +2418,7 @@ assemble_insn(opcode, tok, ntok, insn)
              }
              break;
            default:
-             abort();
+             abort ();
            }
        }
       else
@@ -2467,6 +2478,10 @@ emit_insn (insn)
   f = frag_more (4);
   md_number_to_chars (f, insn->insn, 4);
 
+#ifdef OBJ_ELF
+  dwarf2_emit_insn (4);
+#endif
+
   /* Apply the fixups in order */
   for (i = 0; i < insn->nfixups; ++i)
     {
@@ -2489,7 +2504,7 @@ emit_insn (insn)
       else switch (fixup->reloc)
        {
 #ifdef OBJ_ELF
-         /* These relocation types are only used internally. */
+         /* These relocation types are only used internally.  */
        case BFD_RELOC_ALPHA_GPDISP_HI16:
        case BFD_RELOC_ALPHA_GPDISP_LO16:
          size = 2;
@@ -3058,7 +3073,7 @@ load_expression (targreg, exp, pbasereg, poffset, explicit_reloc)
 
     case O_subtract:
       /* Assume that this difference expression will be resolved to an
-        absolute value and that that value will fit in 16 bits. */
+        absolute value and that that value will fit in 16 bits.  */
 
       assert (explicit_reloc == (const expressionS *)0);
       set_tok_reg (newtok[0], targreg);
@@ -3162,7 +3177,7 @@ load_expression (targreg, exp, pbasereg, poffset, explicit_reloc)
       if (insn.nfixups > 0)
        {
          memmove (&insn.fixups[1], &insn.fixups[0],
-                  sizeof(struct alpha_fixup) * insn.nfixups);
+                  sizeof (struct alpha_fixup) * insn.nfixups);
        }
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
@@ -3288,8 +3303,8 @@ emit_lda (tok, ntok, opname)
              || tok[2].X_op != O_pregister
              || !is_ir_num(tok[2].X_add_number))
            {
-             as_bad (_("bad instruction format for lda !%s!%d"), r->name,
-                     reloc->X_add_number);
+             as_bad (_("bad instruction format for lda !%s!%ld"), r->name,
+                     (long) reloc->X_add_number);
 
              reloc = (const expressionS *)0;
              ntok--;
@@ -3419,7 +3434,7 @@ emit_ir_load (tok, ntok, opname)
       if (insn.nfixups > 0)
        {
          memmove (&insn.fixups[1], &insn.fixups[0],
-                  sizeof(struct alpha_fixup) * insn.nfixups);
+                  sizeof (struct alpha_fixup) * insn.nfixups);
        }
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
@@ -3505,7 +3520,7 @@ emit_loadstore (tok, ntok, opname)
       if (insn.nfixups > 0)
        {
          memmove (&insn.fixups[1], &insn.fixups[0],
-                  sizeof(struct alpha_fixup) * insn.nfixups);
+                  sizeof (struct alpha_fixup) * insn.nfixups);
        }
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
@@ -3670,7 +3685,7 @@ emit_ldil (tok, ntok, unused)
     }
 #endif
 
-  memcpy (newtok, tok, sizeof(newtok));
+  memcpy (newtok, tok, sizeof (newtok));
   newtok[1].X_add_number = sign_extend_32 (tok[1].X_add_number);
 
   assemble_tokens ("lda", newtok, ntok, 1);
@@ -3684,7 +3699,7 @@ emit_stX (tok, ntok, vlgsize)
      int ntok;
      const PTR vlgsize;
 {
-  int lgsize = (int)(long)vlgsize;
+  int lgsize = (int) (long)vlgsize;
 
   if (alpha_target & AXP_OPCODE_BWX)
     emit_loadstore (tok, ntok, stX_op[lgsize]);
@@ -3742,7 +3757,7 @@ emit_ustX (tok, ntok, vlgsize)
      int ntok;
      const PTR vlgsize;
 {
-  int lgsize = (int)(long)vlgsize;
+  int lgsize = (int) (long)vlgsize;
   expressionS newtok[3];
 
   /* emit "lda $at, exp" */
@@ -4162,7 +4177,7 @@ emit_jsrjmp (tok, ntok, vopname)
       if (insn.nfixups > 0)
        {
          memmove (&insn.fixups[1], &insn.fixups[0],
-                  sizeof(struct alpha_fixup) * insn.nfixups);
+                  sizeof (struct alpha_fixup) * insn.nfixups);
        }
       insn.nfixups++;
       insn.fixups[0].reloc = BFD_RELOC_ALPHA_LITUSE;
@@ -4309,7 +4324,7 @@ s_alpha_comm (ignore)
     {
       offsetT align;
 
-      input_line_pointer++;      
+      input_line_pointer++;
       align = get_absolute_expression ();
       bfd_set_section_alignment (stdoutput, new_seg, align);
     }
@@ -4324,7 +4339,7 @@ s_alpha_comm (ignore)
 
 #ifdef OBJ_EVAX
   if (bfd_section_size (stdoutput, new_seg) > 0)
-    { 
+    {
       if (bfd_section_size (stdoutput, new_seg) != temp)
        as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
                S_GET_NAME (symbolP),
@@ -4343,7 +4358,7 @@ s_alpha_comm (ignore)
 #endif
   else
     {
-#ifdef OBJ_EVAX 
+#ifdef OBJ_EVAX
       subseg_set (new_seg, 0);
       p = frag_more (temp);
       new_seg->flags |= SEC_IS_COMMON;
@@ -4556,10 +4571,12 @@ s_alpha_prologue (ignore)
   switch (arg)
     {
       case 0: /* No PV required.  */
-       S_SET_OTHER (sym, STO_ALPHA_NOPV);
+       S_SET_OTHER (sym, STO_ALPHA_NOPV
+                         | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
        break;
       case 1: /* Std GP load.  */
-       S_SET_OTHER (sym, STO_ALPHA_STD_GPLOAD);
+       S_SET_OTHER (sym, STO_ALPHA_STD_GPLOAD
+                         | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
        break;
       case 2: /* Non-std use of PV.  */
        break;
@@ -4567,7 +4584,73 @@ s_alpha_prologue (ignore)
       default:
        as_bad (_("Invalid argument %d to .prologue."), arg);
        break;
-    }  
+    }
+}
+
+static char * first_file_directive;
+
+static void
+s_alpha_file (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  /* Save the first .file directive we see, so that we can change our
+     minds about whether ecoff debugging should or shouldn't be enabled.  */
+  if (alpha_flag_mdebug < 0 && ! first_file_directive)
+    {
+      char *start = input_line_pointer;
+      size_t len;
+
+      discard_rest_of_line ();
+
+      len = input_line_pointer - start;
+      first_file_directive = xmalloc (len + 1);
+      memcpy (first_file_directive, start, len);
+      first_file_directive[len] = '\0';
+
+      input_line_pointer = start;
+    }
+
+  if (ECOFF_DEBUGGING)
+    ecoff_directive_file (0);
+  else
+    dwarf2_directive_file (0);
+}
+
+static void
+s_alpha_loc (ignore)
+     int ignore ATTRIBUTE_UNUSED;
+{
+  if (ECOFF_DEBUGGING)
+    ecoff_directive_loc (0);
+  else
+    dwarf2_directive_loc (0);
+}
+
+static void
+s_alpha_stab (n)
+     int n;
+{
+  /* If we've been undecided about mdebug, make up our minds in favour.  */
+  if (alpha_flag_mdebug < 0)
+    {
+      segT sec = subseg_new(".mdebug", 0);
+      bfd_set_section_flags(stdoutput, sec, SEC_HAS_CONTENTS|SEC_READONLY);
+      bfd_set_section_alignment(stdoutput, sec, 3);
+
+      ecoff_read_begin_hook ();
+
+      if (first_file_directive)
+       {
+         char *save_ilp = input_line_pointer;
+          input_line_pointer = first_file_directive;
+         ecoff_directive_file (0);
+         input_line_pointer = save_ilp;
+         free (first_file_directive);
+       }
+
+      alpha_flag_mdebug = 1;
+    }
+  s_stab (n);
 }
 
 static void
@@ -4580,17 +4663,15 @@ s_alpha_coff_wrapper (which)
     ecoff_directive_def,
     ecoff_directive_dim,
     ecoff_directive_endef,
-    ecoff_directive_file,
     ecoff_directive_scl,
     ecoff_directive_tag,
     ecoff_directive_val,
-    ecoff_directive_loc,
   };
 
-  assert (which >= 0 && which < (int)(sizeof(fns)/sizeof(*fns)));
+  assert (which >= 0 && which < (int) (sizeof (fns)/sizeof (*fns)));
 
   if (ECOFF_DEBUGGING)
-    (*fns[which])(0);
+    (*fns[which]) (0);
   else
     {
       as_bad (_("ECOFF debugging is disabled."));
@@ -4600,9 +4681,9 @@ s_alpha_coff_wrapper (which)
 #endif /* OBJ_ELF */
 
 #ifdef OBJ_EVAX
-  
+
 /* Handle the section specific pseudo-op.  */
-  
+
 static void
 s_alpha_section (secid)
      int secid;
@@ -4626,7 +4707,6 @@ s_alpha_section (secid)
   alpha_current_align = 0;
 }
 
-
 /* Parse .ent directives.  */
 
 static void
@@ -4664,7 +4744,6 @@ s_alpha_ent (ignore)
   return;
 }
 
-
 /* Parse .frame <framreg>,<framesize>,RA,<rsa_offset> directives.  */
 
 static void
@@ -4853,7 +4932,6 @@ s_alpha_pdesc (ignore)
   return;
 }
 
-
 /* Support for crash debug on vms.  */
 
 static void
@@ -4894,7 +4972,6 @@ s_alpha_name (ignore)
   return;
 }
 
-
 static void
 s_alpha_linkage (ignore)
      int ignore;
@@ -4923,7 +5000,6 @@ s_alpha_linkage (ignore)
   return;
 }
 
-
 static void
 s_alpha_code_address (ignore)
      int ignore;
@@ -4952,7 +5028,6 @@ s_alpha_code_address (ignore)
   return;
 }
 
-
 static void
 s_alpha_fp_save (ignore)
      int ignore;
@@ -4964,7 +5039,6 @@ s_alpha_fp_save (ignore)
   return;
 }
 
-
 static void
 s_alpha_mask (ignore)
      int ignore;
@@ -4986,7 +5060,6 @@ s_alpha_mask (ignore)
   return;
 }
 
-
 static void
 s_alpha_fmask (ignore)
      int ignore;
@@ -5022,7 +5095,6 @@ s_alpha_end (ignore)
   return;
 }
 
-
 static void
 s_alpha_file (ignore)
      int ignore;
@@ -5070,7 +5142,7 @@ s_alpha_gprel32 (ignore)
     case O_symbol:
       break;
     default:
-      abort();
+      abort ();
     }
 #else
 #ifdef OBJ_ECOFF
@@ -5455,17 +5527,19 @@ const pseudo_typeS md_pseudo_table[] =
   {"fmask", s_alpha_mask, 1},
   {"frame", s_alpha_frame, 0},
   {"prologue", s_alpha_prologue, 0},
+  {"file", s_alpha_file, 5},
+  {"loc", s_alpha_loc, 9},
+  {"stabs", s_alpha_stab, 's'},
+  {"stabn", s_alpha_stab, 'n'},
   /* COFF debugging related pseudos.  */
   {"begin", s_alpha_coff_wrapper, 0},
   {"bend", s_alpha_coff_wrapper, 1},
   {"def", s_alpha_coff_wrapper, 2},
   {"dim", s_alpha_coff_wrapper, 3},
   {"endef", s_alpha_coff_wrapper, 4},
-  {"file", s_alpha_coff_wrapper, 5},
-  {"scl", s_alpha_coff_wrapper, 6},
-  {"tag", s_alpha_coff_wrapper, 7},
-  {"val", s_alpha_coff_wrapper, 8},
-  {"loc", s_alpha_coff_wrapper, 9},
+  {"scl", s_alpha_coff_wrapper, 5},
+  {"tag", s_alpha_coff_wrapper, 6},
+  {"val", s_alpha_coff_wrapper, 7},
 #else
   {"prologue", s_ignore, 0},
 #endif
@@ -5607,27 +5681,8 @@ alpha_align (n, pfill, label, force)
 
   if (pfill == NULL)
     {
-      if (n > 2
-         && (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
-       {
-         static char const unop[4] = { 0x00, 0x00, 0xe0, 0x2f };
-         static char const nopunop[8] = {
-               0x1f, 0x04, 0xff, 0x47,
-               0x00, 0x00, 0xe0, 0x2f
-         };
-
-         /* First, make sure we're on a four-byte boundary, in case
-            someone has been putting .byte values into the text
-            section.  The DEC assembler silently fills with unaligned
-            no-op instructions.  This will zero-fill, then nop-fill
-            with proper alignment.  */
-         if (alpha_current_align < 2)
-           frag_align (2, 0, 0);
-         if (alpha_current_align < 3)
-           frag_align_pattern (3, unop, sizeof unop, 0);
-         if (n > 3)
-           frag_align_pattern (n, nopunop, sizeof nopunop, 0);
-       }
+      if (subseg_text_p (now_seg))
+       frag_align_code (n, 0);
       else
        frag_align (n, 0, 0);
     }
@@ -5644,10 +5699,55 @@ alpha_align (n, pfill, label, force)
 
   record_alignment (now_seg, n);
 
-  /* ??? if alpha_flag_relax && force && elf, record the requested alignment
+  /* ??? If alpha_flag_relax && force && elf, record the requested alignment
      in a reloc for the linker to see.  */
 }
 
+/* This is called from HANDLE_ALIGN in write.c.  Fill in the contents
+   of an rs_align_code fragment.  */
+
+void
+alpha_handle_align (fragp)
+     fragS *fragp;
+{
+  static char const unop[4] = { 0x00, 0x00, 0xe0, 0x2f };
+  static char const nopunop[8] = {
+       0x1f, 0x04, 0xff, 0x47,
+       0x00, 0x00, 0xe0, 0x2f
+  };
+
+  int bytes, fix;
+  char *p;
+
+  if (fragp->fr_type != rs_align_code)
+    return;
+
+  bytes = fragp->fr_next->fr_address - fragp->fr_address - fragp->fr_fix;
+  p = fragp->fr_literal + fragp->fr_fix;
+  fix = 0;
+
+  if (bytes & 3)
+    {
+      fix = bytes & 3;
+      memset (p, 0, fix);
+      p += fix;
+      bytes -= fix;
+    }
+
+  if (bytes & 4)
+    {
+      memcpy (p, unop, 4);
+      p += 4;
+      bytes -= 4;
+      fix += 4;
+    }
+
+  memcpy (p, nopunop, 8);
+
+  fragp->fr_fix += fix;
+  fragp->fr_var = 8;
+}
+
 /* The Alpha has support for some VAX floating point types, as well as for
    IEEE floating point.  We consider IEEE to be the primary floating point
    format, and sneak in the VAX floating point support here.  */
This page took 0.044829 seconds and 4 git commands to generate.