X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-pdp11.c;h=7de42aea959f0e472f2eddeaf8b58cac27d0e6f2;hb=53fc67f8b2663261810353ae8e4f9920ae7a1c56;hp=529df4f0140ed8cffe3c1905eb772fb4a7b8038a;hpb=6d4af3c269e64b0093b23bd63d302bd9f90de6a9;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c index 529df4f014..7de42aea95 100644 --- a/gas/config/tc-pdp11.c +++ b/gas/config/tc-pdp11.c @@ -1,5 +1,5 @@ /* tc-pdp11.c - pdp11-specific - - Copyright (C) 2001-2016 Free Software Foundation, Inc. + Copyright (C) 2001-2020 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -109,7 +109,7 @@ set_option (const char *arg) arg += 3; } - /* Commersial instructions. */ + /* Commercial instructions. */ if (strcmp (arg, "cis") == 0) pdp11_extension[PDP11_CIS] = yes; /* Call supervisor mode. */ @@ -203,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) { @@ -222,6 +222,16 @@ md_number_to_chars (char con[], valueT value, int nbytes) con[2] = value & 0xff; con[3] = (value >> 8) & 0xff; break; + case 8: + con[0] = (value >> 48) & 0xff; + con[1] = (value >> 56) & 0xff; + con[2] = (value >> 32) & 0xff; + con[3] = (value >> 40) & 0xff; + con[4] = (value >> 16) & 0xff; + con[5] = (value >> 24) & 0xff; + con[6] = value & 0xff; + con[7] = (value >> 8) & 0xff; + break; default: BAD_CASE (nbytes); } @@ -248,11 +258,19 @@ 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; shift = 0; break; + case BFD_RELOC_32: + mask = 0xffffffff; + shift = 0; + break; case BFD_RELOC_PDP11_DISP_8_PCREL: mask = 0x00ff; shift = 1; @@ -283,7 +301,7 @@ 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: @@ -355,6 +373,12 @@ parse_reg (char *str, struct pdp11_code *operand) return str; } + if (ISALNUM (*str) || *str == '_' || *str == '.') + { + operand->error = _("Bad register name"); + str -= 2; + } + return str; } @@ -581,9 +605,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 @@ -1286,9 +1335,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\ @@ -1302,8 +1351,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\ @@ -1384,31 +1433,31 @@ 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; /* This is taken account for in md_apply_fix(). */ reloc->addend = -symbol_get_bfdsym (fixp->fx_addsy)->section->vma; - switch (fixp->fx_r_type) + code = fixp->fx_r_type; + if (fixp->fx_pcrel) { - case BFD_RELOC_16: - if (fixp->fx_pcrel) - code = BFD_RELOC_16_PCREL; - else - code = BFD_RELOC_16; - break; + switch (code) + { + case BFD_RELOC_16: + code = BFD_RELOC_16_PCREL; + break; - case BFD_RELOC_16_PCREL: - code = BFD_RELOC_16_PCREL; - break; + case BFD_RELOC_16_PCREL: + break; - default: - BAD_CASE (fixp->fx_r_type); - return NULL; + default: + BAD_CASE (code); + return NULL; + } } reloc->howto = bfd_reloc_type_lookup (stdoutput, code);