Store objfiles on a std::list
[deliverable/binutils-gdb.git] / gas / config / tc-pdp11.c
index 98e241f67b7e5935038345aedb1c15fd7f7637aa..1be07eaf5938ea2b3c6be0336923f1973bee0784 100644 (file)
@@ -1,6 +1,5 @@
 /* tc-pdp11.c - pdp11-specific -
-   Copyright 2001, 2002, 2004, 2005, 2007, 2009
-   Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -31,7 +30,7 @@ extern int flonum_gen2vax (int, FLONUM_TYPE * f, LITTLENUM_TYPE *);
 /* A representation for PDP-11 machine code.  */
 struct pdp11_code
 {
-  char *error;
+  const char *error;
   int code;
   int additional;      /* Is there an additional word?  */
   int word;            /* Additional word, if any.  */
@@ -86,7 +85,7 @@ const pseudo_typeS md_pseudo_table[] =
 static struct hash_control *insn_hash = NULL;
 \f
 static int
-set_option (char *arg)
+set_option (const char *arg)
 {
   int yes = 1;
 
@@ -110,7 +109,7 @@ set_option (char *arg)
       arg += 3;
     }
 
-  /* Commersial instructions.  */
+  /* Commercial instructions.  */
   if (strcmp (arg, "cis") == 0)
     pdp11_extension[PDP11_CIS] = yes;
   /* Call supervisor mode.  */
@@ -204,7 +203,7 @@ md_number_to_chars (char con[], valueT value, int nbytes)
 {
   /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
      0x12345678 is stored as "\x56\x78\x12\x34". It's
-     anyones guess what 0x123456 would be stored like.  */
+     anyone's guess what 0x123456 would be stored like.  */
 
   switch (nbytes)
     {
@@ -249,6 +248,10 @@ md_apply_fix (fixS *fixP,
 
   switch (fixP->fx_r_type)
     {
+    case BFD_RELOC_8:
+      mask = 0xff;
+      shift = 0;
+      break;
     case BFD_RELOC_16:
     case BFD_RELOC_16_PCREL:
       mask = 0xffff;
@@ -280,13 +283,11 @@ md_apply_fix (fixS *fixP,
 }
 
 long
-md_chars_to_number (con, nbytes)
-     unsigned char con[];      /* Low order byte 1st.  */
-     int nbytes;               /* Number of bytes in the input.  */
+md_chars_to_number (unsigned char *con, int nbytes)
 {
   /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
      0x12345678 is stored as "\x56\x78\x12\x34". It's
-     anyones guess what 0x123456 would be stored like.  */
+     anyone's guess what 0x123456 would be stored like.  */
   switch (nbytes)
     {
     case 0:
@@ -353,10 +354,7 @@ parse_reg (char *str, struct pdp11_code *operand)
       str += 2;
     }
   else
-    {
-      operand->error = _("Bad register name");
-      return str;
-    }
+    operand->error = _("Bad register name");
 
   return str;
 }
@@ -584,9 +582,34 @@ parse_op_noreg (char *str, struct pdp11_code *operand)
 
   if (*str == '@' || *str == '*')
     {
-      str = parse_op_no_deferred (str + 1, operand);
+      /* @(Rn) == @0(Rn): Mode 7, Indexed deferred.
+        Check for auto-increment deferred.  */
+      if (str[1] == '('
+         && str[2] != 0
+         && str[3] != 0
+         && str[4] != 0
+         && str[5] != '+')
+        {
+         /* Change implied to explicit index deferred.  */
+          *str = '0';
+          str = parse_op_no_deferred (str, operand);
+        }
+      else
+        {
+          /* @Rn == (Rn): Register deferred.  */
+          str = parse_reg (str + 1, operand);
+         
+          /* Not @Rn */
+          if (operand->error)
+           {
+             operand->error = NULL;
+             str = parse_op_no_deferred (str, operand);
+           }
+        }
+
       if (operand->error)
        return str;
+
       operand->code |= 010;
     }
   else
@@ -652,7 +675,7 @@ md_assemble (char *instruction_string)
   struct pdp11_code insn, op1, op2;
   int error;
   int size;
-  char *err = NULL;
+  const char *err = NULL;
   char *str;
   char *p;
   char c;
@@ -698,8 +721,6 @@ md_assemble (char *instruction_string)
     {
     case PDP11_OPCODE_NO_OPS:
       str = skip_whitespace (str);
-      if (*str == 0)
-       str = "";
       break;
 
     case PDP11_OPCODE_IMM3:
@@ -1046,7 +1067,7 @@ md_create_long_jump (char *ptr ATTRIBUTE_UNUSED,
 }
 
 static int
-set_cpu_model (char *arg)
+set_cpu_model (const char *arg)
 {
   char buf[4];
   char *model = buf;
@@ -1162,7 +1183,7 @@ set_cpu_model (char *arg)
 }
 
 static int
-set_machine_model (char *arg)
+set_machine_model (const char *arg)
 {
   if (strncmp (arg, "pdp-11/", 7) != 0
       && strncmp (arg, "pdp11/", 6) != 0
@@ -1249,7 +1270,7 @@ size_t md_longopts_size = sizeof (md_longopts);
    See if it's a processor-specific option.  */
 
 int
-md_parse_option (int c, char *arg)
+md_parse_option (int c, const char *arg)
 {
   init_defaults ();
 
@@ -1291,9 +1312,9 @@ md_show_usage (FILE *stream)
 {
   fprintf (stream, "\
 \n\
-PDP-11 instruction set extentions:\n\
+PDP-11 instruction set extensions:\n\
 \n\
--m(no-)cis             allow (disallow) commersial instruction set\n\
+-m(no-)cis             allow (disallow) commercial instruction set\n\
 -m(no-)csm             allow (disallow) CSM instruction\n\
 -m(no-)eis             allow (disallow) full extended instruction set\n\
 -m(no-)fis             allow (disallow) KEV11 floating-point instructions\n\
@@ -1307,8 +1328,8 @@ PDP-11 instruction set extentions:\n\
 -m(no-)ucode           allow (disallow) microcode instructions\n\
 -mall-extensions       allow all instruction set extensions\n\
                        (this is the default)\n\
--mno-extentions                disallow all instruction set extensions\n\
--pic                   generate position-indepenent code\n\
+-mno-extensions                disallow all instruction set extensions\n\
+-pic                   generate position-independent code\n\
 \n\
 PDP-11 CPU model options:\n\
 \n\
@@ -1389,9 +1410,9 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED,
   arelent *reloc;
   bfd_reloc_code_real_type code;
 
-  reloc = xmalloc (sizeof (* reloc));
+  reloc = XNEW (arelent);
 
-  reloc->sym_ptr_ptr = xmalloc (sizeof (asymbol *));
+  reloc->sym_ptr_ptr = XNEW (asymbol *);
   *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
 
@@ -1447,7 +1468,7 @@ pseudo_even (int c ATTRIBUTE_UNUSED)
   record_alignment (now_seg, alignment);
 }
 
-char *
+const char *
 md_atof (int type, char * litP, int * sizeP)
 {
   return vax_md_atof (type, litP, sizeP);
This page took 0.026507 seconds and 4 git commands to generate.