1 /* tc-pdp11.c - pdp11-specific -
2 Copyright 2001, 2002, 2004, 2005, 2007, 2009
3 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street - Fifth Floor,
20 Boston, MA 02110-1301, USA. */
23 #include "safe-ctype.h"
24 #include "opcode/pdp11.h"
26 extern int flonum_gen2vax (int, FLONUM_TYPE
* f
, LITTLENUM_TYPE
*);
31 /* A representation for PDP-11 machine code. */
36 int additional
; /* Is there an additional word? */
37 int word
; /* Additional word, if any. */
40 bfd_reloc_code_real_type type
;
46 /* Instruction set extensions.
48 If you change this from an array to something else, please update
49 the "PDP-11 instruction set extensions" comment in pdp11.h. */
50 int pdp11_extension
[PDP11_EXT_NUM
];
52 /* Assembly options. */
57 int asm_option
[ASM_OPT_NUM
];
59 /* These chars start a comment anywhere in a source file (except inside
61 const char comment_chars
[] = "#/";
63 /* These chars only start a comment at the beginning of a line. */
64 const char line_comment_chars
[] = "#/";
66 const char line_separator_chars
[] = ";";
68 /* Chars that can be used to separate mant from exp in floating point nums. */
69 const char EXP_CHARS
[] = "eE";
71 /* Chars that mean this number is a floating point constant. */
72 /* as in 0f123.456. */
73 /* or 0H1.234E-12 (see exp chars above). */
74 const char FLT_CHARS
[] = "dDfF";
76 void pseudo_even (int);
77 void pseudo_bss (int);
79 const pseudo_typeS md_pseudo_table
[] =
81 { "bss", pseudo_bss
, 0 },
82 { "even", pseudo_even
, 0 },
86 static struct hash_control
*insn_hash
= NULL
;
89 set_option (char *arg
)
93 if (strcmp (arg
, "all-extensions") == 0
94 || strcmp (arg
, "all") == 0)
96 memset (pdp11_extension
, ~0, sizeof pdp11_extension
);
97 pdp11_extension
[PDP11_NONE
] = 0;
100 else if (strcmp (arg
, "no-extensions") == 0)
102 memset (pdp11_extension
, 0, sizeof pdp11_extension
);
103 pdp11_extension
[PDP11_BASIC
] = 1;
107 if (strncmp (arg
, "no-", 3) == 0)
113 /* Commersial instructions. */
114 if (strcmp (arg
, "cis") == 0)
115 pdp11_extension
[PDP11_CIS
] = yes
;
116 /* Call supervisor mode. */
117 else if (strcmp (arg
, "csm") == 0)
118 pdp11_extension
[PDP11_CSM
] = yes
;
119 /* Extended instruction set. */
120 else if (strcmp (arg
, "eis") == 0)
121 pdp11_extension
[PDP11_EIS
] = pdp11_extension
[PDP11_LEIS
] = yes
;
122 /* KEV11 floating-point. */
123 else if (strcmp (arg
, "fis") == 0
124 || strcmp (arg
, "kev11") == 0
125 || strcmp (arg
, "kev-11") == 0)
126 pdp11_extension
[PDP11_FIS
] = yes
;
127 /* FP-11 floating-point. */
128 else if (strcmp (arg
, "fpp") == 0
129 || strcmp (arg
, "fpu") == 0
130 || strcmp (arg
, "fp11") == 0
131 || strcmp (arg
, "fp-11") == 0
132 || strcmp (arg
, "fpj11") == 0
133 || strcmp (arg
, "fp-j11") == 0
134 || strcmp (arg
, "fpj-11") == 0)
135 pdp11_extension
[PDP11_FPP
] = yes
;
136 /* Limited extended insns. */
137 else if (strcmp (arg
, "limited-eis") == 0)
139 pdp11_extension
[PDP11_LEIS
] = yes
;
140 if (!pdp11_extension
[PDP11_LEIS
])
141 pdp11_extension
[PDP11_EIS
] = 0;
143 /* Move from processor type. */
144 else if (strcmp (arg
, "mfpt") == 0)
145 pdp11_extension
[PDP11_MFPT
] = yes
;
146 /* Multiprocessor insns: */
147 else if (strncmp (arg
, "mproc", 5) == 0
149 || strncmp (arg
, "multiproc", 9) == 0)
150 pdp11_extension
[PDP11_MPROC
] = yes
;
151 /* Move from/to proc status. */
152 else if (strcmp (arg
, "mxps") == 0)
153 pdp11_extension
[PDP11_MXPS
] = yes
;
154 /* Position-independent code. */
155 else if (strcmp (arg
, "pic") == 0)
156 asm_option
[ASM_OPT_PIC
] = yes
;
157 /* Set priority level. */
158 else if (strcmp (arg
, "spl") == 0)
159 pdp11_extension
[PDP11_SPL
] = yes
;
160 /* Microcode instructions: */
161 else if (strcmp (arg
, "ucode") == 0
163 || strcmp (arg
, "microcode") == 0)
164 pdp11_extension
[PDP11_UCODE
] = yes
;
175 static int first
= 1;
179 set_option ("all-extensions");
192 insn_hash
= hash_new ();
193 if (insn_hash
== NULL
)
194 as_fatal (_("Virtual memory exhausted"));
196 for (i
= 0; i
< pdp11_num_opcodes
; i
++)
197 hash_insert (insn_hash
, pdp11_opcodes
[i
].name
, (void *) (pdp11_opcodes
+ i
));
198 for (i
= 0; i
< pdp11_num_aliases
; i
++)
199 hash_insert (insn_hash
, pdp11_aliases
[i
].name
, (void *) (pdp11_aliases
+ i
));
203 md_number_to_chars (char con
[], valueT value
, int nbytes
)
205 /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
206 0x12345678 is stored as "\x56\x78\x12\x34". It's
207 anyones guess what 0x123456 would be stored like. */
214 con
[0] = value
& 0xff;
217 con
[0] = value
& 0xff;
218 con
[1] = (value
>> 8) & 0xff;
221 con
[0] = (value
>> 16) & 0xff;
222 con
[1] = (value
>> 24) & 0xff;
223 con
[2] = value
& 0xff;
224 con
[3] = (value
>> 8) & 0xff;
231 /* Fix up some data or instructions after we find out the value of a symbol
232 that they reference. Knows about order of bytes in address. */
235 md_apply_fix (fixS
*fixP
,
237 segT seg ATTRIBUTE_UNUSED
)
246 buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
247 size
= fixP
->fx_size
;
248 code
= md_chars_to_number ((unsigned char *) buf
, size
);
250 switch (fixP
->fx_r_type
)
253 case BFD_RELOC_16_PCREL
:
257 case BFD_RELOC_PDP11_DISP_8_PCREL
:
261 case BFD_RELOC_PDP11_DISP_6_PCREL
:
267 BAD_CASE (fixP
->fx_r_type
);
270 if (fixP
->fx_addsy
!= NULL
)
271 val
+= symbol_get_bfdsym (fixP
->fx_addsy
)->section
->vma
;
272 /* *value += fixP->fx_addsy->bsym->section->vma; */
275 code
|= (val
>> shift
) & mask
;
276 number_to_chars_littleendian (buf
, code
, size
);
278 if (fixP
->fx_addsy
== NULL
&& fixP
->fx_pcrel
== 0)
283 md_chars_to_number (con
, nbytes
)
284 unsigned char con
[]; /* Low order byte 1st. */
285 int nbytes
; /* Number of bytes in the input. */
287 /* On a PDP-11, 0x1234 is stored as "\x12\x34", and
288 0x12345678 is stored as "\x56\x78\x12\x34". It's
289 anyones guess what 0x123456 would be stored like. */
297 return (con
[1] << BITS_PER_CHAR
) | con
[0];
300 (((con
[1] << BITS_PER_CHAR
) | con
[0]) << (2 * BITS_PER_CHAR
))
301 |((con
[3] << BITS_PER_CHAR
) | con
[2]);
309 skip_whitespace (char *str
)
311 while (*str
== ' ' || *str
== '\t')
317 find_whitespace (char *str
)
319 while (*str
!= ' ' && *str
!= '\t' && *str
!= 0)
325 parse_reg (char *str
, struct pdp11_code
*operand
)
327 str
= skip_whitespace (str
);
328 if (TOLOWER (*str
) == 'r')
333 case '0': case '1': case '2': case '3':
334 case '4': case '5': case '6': case '7':
335 operand
->code
= *str
- '0';
339 operand
->error
= _("Bad register name");
343 else if (strncmp (str
, "sp", 2) == 0
344 || strncmp (str
, "SP", 2) == 0)
349 else if (strncmp (str
, "pc", 2) == 0
350 || strncmp (str
, "PC", 2) == 0)
357 operand
->error
= _("Bad register name");
365 parse_ac5 (char *str
, struct pdp11_code
*operand
)
367 str
= skip_whitespace (str
);
368 if (strncmp (str
, "fr", 2) == 0
369 || strncmp (str
, "FR", 2) == 0
370 || strncmp (str
, "ac", 2) == 0
371 || strncmp (str
, "AC", 2) == 0)
376 case '0': case '1': case '2': case '3':
378 operand
->code
= *str
- '0';
382 operand
->error
= _("Bad register name");
388 operand
->error
= _("Bad register name");
396 parse_ac (char *str
, struct pdp11_code
*operand
)
398 str
= parse_ac5 (str
, operand
);
399 if (!operand
->error
&& operand
->code
> 3)
401 operand
->error
= _("Bad register name");
409 parse_expression (char *str
, struct pdp11_code
*operand
)
411 char *save_input_line_pointer
;
414 save_input_line_pointer
= input_line_pointer
;
415 input_line_pointer
= str
;
416 seg
= expression (&operand
->reloc
.exp
);
419 input_line_pointer
= save_input_line_pointer
;
420 operand
->error
= _("Error in expression");
424 str
= input_line_pointer
;
425 input_line_pointer
= save_input_line_pointer
;
427 operand
->reloc
.pc_rel
= 0;
433 parse_op_no_deferred (char *str
, struct pdp11_code
*operand
)
435 LITTLENUM_TYPE literal_float
[2];
437 str
= skip_whitespace (str
);
441 case '(': /* (rn) and (rn)+ */
442 str
= parse_reg (str
+ 1, operand
);
445 str
= skip_whitespace (str
);
448 operand
->error
= _("Missing ')'");
454 operand
->code
|= 020;
459 operand
->code
|= 010;
466 str
= parse_expression (str
+ 1, operand
);
469 operand
->additional
= TRUE
;
470 operand
->word
= operand
->reloc
.exp
.X_add_number
;
471 switch (operand
->reloc
.exp
.X_op
)
478 operand
->reloc
.type
= BFD_RELOC_16
;
479 operand
->reloc
.pc_rel
= 0;
482 if (operand
->reloc
.exp
.X_add_number
> 0)
484 operand
->error
= _("Error in expression");
487 /* It's a floating literal... */
488 know (operand
->reloc
.exp
.X_add_number
< 0);
489 flonum_gen2vax ('f', &generic_floating_point_number
, literal_float
);
490 operand
->word
= literal_float
[0];
491 if (literal_float
[1] != 0)
492 as_warn (_("Low order bits truncated in immediate float operand"));
495 operand
->error
= _("Error in expression");
501 /* label, d(rn), -(rn) */
506 if (strncmp (str
, "-(", 2) == 0) /* -(rn) */
508 str
= parse_reg (str
+ 2, operand
);
511 str
= skip_whitespace (str
);
514 operand
->error
= _("Missing ')'");
517 operand
->code
|= 040;
522 str
= parse_expression (str
, operand
);
526 str
= skip_whitespace (str
);
530 if (operand
->reloc
.exp
.X_op
!= O_symbol
)
532 operand
->error
= _("Label expected");
536 operand
->additional
= 1;
538 operand
->reloc
.type
= BFD_RELOC_16_PCREL
;
539 operand
->reloc
.pc_rel
= 1;
545 str
= parse_reg (str
, operand
);
549 str
= skip_whitespace (str
);
553 operand
->error
= _("Missing ')'");
558 operand
->additional
= TRUE
;
559 operand
->code
|= 060;
560 switch (operand
->reloc
.exp
.X_op
)
563 operand
->reloc
.type
= BFD_RELOC_16
;
564 operand
->reloc
.pc_rel
= 0;
567 if ((operand
->code
& 7) == 7)
569 operand
->reloc
.pc_rel
= 1;
570 operand
->word
= operand
->reloc
.exp
.X_add_number
;
573 operand
->word
= operand
->reloc
.exp
.X_add_number
;
577 BAD_CASE (operand
->reloc
.exp
.X_op
);
587 parse_op_noreg (char *str
, struct pdp11_code
*operand
)
589 str
= skip_whitespace (str
);
590 operand
->error
= NULL
;
592 if (*str
== '@' || *str
== '*')
594 str
= parse_op_no_deferred (str
+ 1, operand
);
597 operand
->code
|= 010;
600 str
= parse_op_no_deferred (str
, operand
);
606 parse_op (char *str
, struct pdp11_code
*operand
)
608 str
= skip_whitespace (str
);
610 str
= parse_reg (str
, operand
);
614 operand
->error
= NULL
;
615 parse_ac5 (str
, operand
);
618 operand
->error
= _("Float AC not legal as integer operand");
622 return parse_op_noreg (str
, operand
);
626 parse_fop (char *str
, struct pdp11_code
*operand
)
628 str
= skip_whitespace (str
);
630 str
= parse_ac5 (str
, operand
);
634 operand
->error
= NULL
;
635 parse_reg (str
, operand
);
638 operand
->error
= _("General register not legal as float operand");
642 return parse_op_noreg (str
, operand
);
646 parse_separator (char *str
, int *error
)
648 str
= skip_whitespace (str
);
649 *error
= (*str
!= ',');
656 md_assemble (char *instruction_string
)
658 const struct pdp11_opcode
*op
;
659 struct pdp11_code insn
, op1
, op2
;
667 str
= skip_whitespace (instruction_string
);
668 p
= find_whitespace (str
);
671 as_bad (_("No instruction found"));
677 op
= (struct pdp11_opcode
*)hash_find (insn_hash
, str
);
681 as_bad (_("Unknown instruction '%s'"), str
);
685 if (!pdp11_extension
[op
->extension
])
687 as_warn (_("Unsupported instruction set extension: %s"), op
->name
);
692 insn
.code
= op
->opcode
;
693 insn
.reloc
.type
= BFD_RELOC_NONE
;
695 op1
.additional
= FALSE
;
696 op1
.reloc
.type
= BFD_RELOC_NONE
;
698 op2
.additional
= FALSE
;
699 op2
.reloc
.type
= BFD_RELOC_NONE
;
706 case PDP11_OPCODE_NO_OPS
:
707 str
= skip_whitespace (str
);
712 case PDP11_OPCODE_IMM3
:
713 case PDP11_OPCODE_IMM6
:
714 case PDP11_OPCODE_IMM8
:
715 str
= skip_whitespace (str
);
716 if (*str
== '#' || *str
== '$')
718 str
= parse_expression (str
, &op1
);
721 if (op1
.reloc
.exp
.X_op
!= O_constant
|| op1
.reloc
.type
!= BFD_RELOC_NONE
)
723 op1
.error
= _("operand is not an absolute constant");
728 case PDP11_OPCODE_IMM3
:
729 if (op1
.reloc
.exp
.X_add_number
& ~7)
731 op1
.error
= _("3-bit immediate out of range");
735 case PDP11_OPCODE_IMM6
:
736 if (op1
.reloc
.exp
.X_add_number
& ~0x3f)
738 op1
.error
= _("6-bit immediate out of range");
742 case PDP11_OPCODE_IMM8
:
743 if (op1
.reloc
.exp
.X_add_number
& ~0xff)
745 op1
.error
= _("8-bit immediate out of range");
750 insn
.code
|= op1
.reloc
.exp
.X_add_number
;
753 case PDP11_OPCODE_DISPL
:
756 new_pointer
= parse_expression (str
, &op1
);
758 op1
.reloc
.pc_rel
= 1;
759 op1
.reloc
.type
= BFD_RELOC_PDP11_DISP_8_PCREL
;
760 if (op1
.reloc
.exp
.X_op
!= O_symbol
)
762 op1
.error
= _("Symbol expected");
765 if (op1
.code
& ~0xff)
767 err
= _("8-bit displacement out of range");
771 insn
.code
|= op1
.code
;
772 insn
.reloc
= op1
.reloc
;
776 case PDP11_OPCODE_REG
:
777 str
= parse_reg (str
, &op1
);
780 insn
.code
|= op1
.code
;
783 case PDP11_OPCODE_OP
:
784 str
= parse_op (str
, &op1
);
787 insn
.code
|= op1
.code
;
792 case PDP11_OPCODE_FOP
:
793 str
= parse_fop (str
, &op1
);
796 insn
.code
|= op1
.code
;
801 case PDP11_OPCODE_REG_OP
:
802 str
= parse_reg (str
, &op2
);
805 insn
.code
|= op2
.code
<< 6;
806 str
= parse_separator (str
, &error
);
809 op2
.error
= _("Missing ','");
812 str
= parse_op (str
, &op1
);
815 insn
.code
|= op1
.code
;
820 case PDP11_OPCODE_REG_OP_REV
:
821 str
= parse_op (str
, &op1
);
824 insn
.code
|= op1
.code
;
827 str
= parse_separator (str
, &error
);
830 op2
.error
= _("Missing ','");
833 str
= parse_reg (str
, &op2
);
836 insn
.code
|= op2
.code
<< 6;
839 case PDP11_OPCODE_AC_FOP
:
840 str
= parse_ac (str
, &op2
);
843 insn
.code
|= op2
.code
<< 6;
844 str
= parse_separator (str
, &error
);
847 op1
.error
= _("Missing ','");
850 str
= parse_fop (str
, &op1
);
853 insn
.code
|= op1
.code
;
858 case PDP11_OPCODE_FOP_AC
:
859 str
= parse_fop (str
, &op1
);
862 insn
.code
|= op1
.code
;
865 str
= parse_separator (str
, &error
);
868 op1
.error
= _("Missing ','");
871 str
= parse_ac (str
, &op2
);
874 insn
.code
|= op2
.code
<< 6;
877 case PDP11_OPCODE_AC_OP
:
878 str
= parse_ac (str
, &op2
);
881 insn
.code
|= op2
.code
<< 6;
882 str
= parse_separator (str
, &error
);
885 op1
.error
= _("Missing ','");
888 str
= parse_op (str
, &op1
);
891 insn
.code
|= op1
.code
;
896 case PDP11_OPCODE_OP_AC
:
897 str
= parse_op (str
, &op1
);
900 insn
.code
|= op1
.code
;
903 str
= parse_separator (str
, &error
);
906 op1
.error
= _("Missing ','");
909 str
= parse_ac (str
, &op2
);
912 insn
.code
|= op2
.code
<< 6;
915 case PDP11_OPCODE_OP_OP
:
916 str
= parse_op (str
, &op1
);
919 insn
.code
|= op1
.code
<< 6;
922 str
= parse_separator (str
, &error
);
925 op2
.error
= _("Missing ','");
928 str
= parse_op (str
, &op2
);
931 insn
.code
|= op2
.code
;
936 case PDP11_OPCODE_REG_DISPL
:
939 str
= parse_reg (str
, &op2
);
942 insn
.code
|= op2
.code
<< 6;
943 str
= parse_separator (str
, &error
);
946 op1
.error
= _("Missing ','");
949 new_pointer
= parse_expression (str
, &op1
);
951 op1
.reloc
.pc_rel
= 1;
952 op1
.reloc
.type
= BFD_RELOC_PDP11_DISP_6_PCREL
;
953 if (op1
.reloc
.exp
.X_op
!= O_symbol
)
955 op1
.error
= _("Symbol expected");
958 if (op1
.code
& ~0x3f)
960 err
= _("6-bit displacement out of range");
964 insn
.code
|= op1
.code
;
965 insn
.reloc
= op1
.reloc
;
979 str
= skip_whitespace (str
);
981 err
= _("Too many operands");
993 to
= frag_more (size
);
995 md_number_to_chars (to
, insn
.code
, 2);
996 if (insn
.reloc
.type
!= BFD_RELOC_NONE
)
997 fix_new_exp (frag_now
, to
- frag_now
->fr_literal
, 2,
998 &insn
.reloc
.exp
, insn
.reloc
.pc_rel
, insn
.reloc
.type
);
1003 md_number_to_chars (to
, op1
.word
, 2);
1004 if (op1
.reloc
.type
!= BFD_RELOC_NONE
)
1005 fix_new_exp (frag_now
, to
- frag_now
->fr_literal
, 2,
1006 &op1
.reloc
.exp
, op1
.reloc
.pc_rel
, op1
.reloc
.type
);
1012 md_number_to_chars (to
, op2
.word
, 2);
1013 if (op2
.reloc
.type
!= BFD_RELOC_NONE
)
1014 fix_new_exp (frag_now
, to
- frag_now
->fr_literal
, 2,
1015 &op2
.reloc
.exp
, op2
.reloc
.pc_rel
, op2
.reloc
.type
);
1021 md_estimate_size_before_relax (fragS
*fragP ATTRIBUTE_UNUSED
,
1022 segT segment ATTRIBUTE_UNUSED
)
1028 md_convert_frag (bfd
*headers ATTRIBUTE_UNUSED
,
1029 segT seg ATTRIBUTE_UNUSED
,
1030 fragS
*fragP ATTRIBUTE_UNUSED
)
1034 int md_short_jump_size
= 2;
1035 int md_long_jump_size
= 4;
1038 md_create_short_jump (char *ptr ATTRIBUTE_UNUSED
,
1039 addressT from_addr ATTRIBUTE_UNUSED
,
1040 addressT to_addr ATTRIBUTE_UNUSED
,
1041 fragS
*frag ATTRIBUTE_UNUSED
,
1042 symbolS
*to_symbol ATTRIBUTE_UNUSED
)
1047 md_create_long_jump (char *ptr ATTRIBUTE_UNUSED
,
1048 addressT from_addr ATTRIBUTE_UNUSED
,
1049 addressT to_addr ATTRIBUTE_UNUSED
,
1050 fragS
*frag ATTRIBUTE_UNUSED
,
1051 symbolS
*to_symbol ATTRIBUTE_UNUSED
)
1056 set_cpu_model (char *arg
)
1066 if (strchr ("abdx", model
[-1]) == NULL
)
1069 if (model
[-1] == 'd')
1071 if (arg
[0] == 'f' || arg
[0] == 'j')
1074 else if (model
[-1] == 'x')
1083 if (strncmp (arg
, "11", 2) != 0)
1093 /* Allow up to two revision letters. */
1101 set_option ("no-extensions");
1103 /* KA11 (11/15/20). */
1104 if (strncmp (buf
, "a", 1) == 0)
1105 return 1; /* No extensions. */
1107 /* KB11 (11/45/50/55/70). */
1108 else if (strncmp (buf
, "b", 1) == 0)
1109 return set_option ("eis") && set_option ("spl");
1111 /* KD11-A (11/35/40). */
1112 else if (strncmp (buf
, "da", 2) == 0)
1113 return set_option ("limited-eis");
1115 /* KD11-B (11/05/10). */
1116 else if (strncmp (buf
, "db", 2) == 0
1117 /* KD11-D (11/04). */
1118 || strncmp (buf
, "dd", 2) == 0)
1119 return 1; /* no extensions */
1121 /* KD11-E (11/34). */
1122 else if (strncmp (buf
, "de", 2) == 0)
1123 return set_option ("eis") && set_option ("mxps");
1125 /* KD11-F (11/03). */
1126 else if (strncmp (buf
, "df", 2) == 0
1127 /* KD11-H (11/03). */
1128 || strncmp (buf
, "dh", 2) == 0
1129 /* KD11-Q (11/03). */
1130 || strncmp (buf
, "dq", 2) == 0)
1131 return set_option ("limited-eis") && set_option ("mxps");
1133 /* KD11-K (11/60). */
1134 else if (strncmp (buf
, "dk", 2) == 0)
1135 return set_option ("eis")
1136 && set_option ("mxps")
1137 && set_option ("ucode");
1139 /* KD11-Z (11/44). */
1140 else if (strncmp (buf
, "dz", 2) == 0)
1141 return set_option ("csm")
1142 && set_option ("eis")
1143 && set_option ("mfpt")
1144 && set_option ("mxps")
1145 && set_option ("spl");
1147 /* F11 (11/23/24). */
1148 else if (strncmp (buf
, "f", 1) == 0)
1149 return set_option ("eis")
1150 && set_option ("mfpt")
1151 && set_option ("mxps");
1153 /* J11 (11/53/73/83/84/93/94). */
1154 else if (strncmp (buf
, "j", 1) == 0)
1155 return set_option ("csm")
1156 && set_option ("eis")
1157 && set_option ("mfpt")
1158 && set_option ("multiproc")
1159 && set_option ("mxps")
1160 && set_option ("spl");
1163 else if (strncmp (buf
, "t", 1) == 0)
1164 return set_option ("limited-eis")
1165 && set_option ("mxps");
1172 set_machine_model (char *arg
)
1174 if (strncmp (arg
, "pdp-11/", 7) != 0
1175 && strncmp (arg
, "pdp11/", 6) != 0
1176 && strncmp (arg
, "11/", 3) != 0)
1179 if (strncmp (arg
, "pdp", 3) == 0)
1183 if (strncmp (arg
, "11/", 3) == 0)
1186 if (strcmp (arg
, "03") == 0)
1187 return set_cpu_model ("kd11f");
1189 else if (strcmp (arg
, "04") == 0)
1190 return set_cpu_model ("kd11d");
1192 else if (strcmp (arg
, "05") == 0
1193 || strcmp (arg
, "10") == 0)
1194 return set_cpu_model ("kd11b");
1196 else if (strcmp (arg
, "15") == 0
1197 || strcmp (arg
, "20") == 0)
1198 return set_cpu_model ("ka11");
1200 else if (strcmp (arg
, "21") == 0)
1201 return set_cpu_model ("t11");
1203 else if (strcmp (arg
, "23") == 0
1204 || strcmp (arg
, "24") == 0)
1205 return set_cpu_model ("f11");
1207 else if (strcmp (arg
, "34") == 0
1208 || strcmp (arg
, "34a") == 0)
1209 return set_cpu_model ("kd11e");
1211 else if (strcmp (arg
, "35") == 0
1212 || strcmp (arg
, "40") == 0)
1213 return set_cpu_model ("kd11da");
1215 else if (strcmp (arg
, "44") == 0)
1216 return set_cpu_model ("kd11dz");
1218 else if (strcmp (arg
, "45") == 0
1219 || strcmp (arg
, "50") == 0
1220 || strcmp (arg
, "55") == 0
1221 || strcmp (arg
, "70") == 0)
1222 return set_cpu_model ("kb11");
1224 else if (strcmp (arg
, "60") == 0)
1225 return set_cpu_model ("kd11k");
1227 else if (strcmp (arg
, "53") == 0
1228 || strcmp (arg
, "73") == 0
1229 || strcmp (arg
, "83") == 0
1230 || strcmp (arg
, "84") == 0
1231 || strcmp (arg
, "93") == 0
1232 || strcmp (arg
, "94") == 0)
1233 return set_cpu_model ("j11")
1234 && set_option ("fpp");
1240 const char *md_shortopts
= "m:";
1242 struct option md_longopts
[] =
1244 #define OPTION_CPU 257
1245 { "cpu", required_argument
, NULL
, OPTION_CPU
},
1246 #define OPTION_MACHINE 258
1247 { "machine", required_argument
, NULL
, OPTION_MACHINE
},
1248 #define OPTION_PIC 259
1249 { "pic", no_argument
, NULL
, OPTION_PIC
},
1250 { NULL
, no_argument
, NULL
, 0 }
1253 size_t md_longopts_size
= sizeof (md_longopts
);
1255 /* Invocation line includes a switch not recognized by the base assembler.
1256 See if it's a processor-specific option. */
1259 md_parse_option (int c
, char *arg
)
1266 if (set_option (arg
))
1268 if (set_cpu_model (arg
))
1270 if (set_machine_model (arg
))
1275 if (set_cpu_model (arg
))
1279 case OPTION_MACHINE
:
1280 if (set_machine_model (arg
))
1285 if (set_option ("pic"))
1297 md_show_usage (FILE *stream
)
1301 PDP-11 instruction set extentions:\n\
1303 -m(no-)cis allow (disallow) commersial instruction set\n\
1304 -m(no-)csm allow (disallow) CSM instruction\n\
1305 -m(no-)eis allow (disallow) full extended instruction set\n\
1306 -m(no-)fis allow (disallow) KEV11 floating-point instructions\n\
1307 -m(no-)fpp allow (disallow) FP-11 floating-point instructions\n\
1308 -m(no-)fpu allow (disallow) FP-11 floating-point instructions\n\
1309 -m(no-)limited-eis allow (disallow) limited extended instruction set\n\
1310 -m(no-)mfpt allow (disallow) processor type instruction\n\
1311 -m(no-)multiproc allow (disallow) multiprocessor instructions\n\
1312 -m(no-)mxps allow (disallow) processor status instructions\n\
1313 -m(no-)spl allow (disallow) SPL instruction\n\
1314 -m(no-)ucode allow (disallow) microcode instructions\n\
1315 -mall-extensions allow all instruction set extensions\n\
1316 (this is the default)\n\
1317 -mno-extentions disallow all instruction set extensions\n\
1318 -pic generate position-indepenent code\n\
1320 PDP-11 CPU model options:\n\
1322 -mka11* KA11 CPU. base line instruction set only\n\
1323 -mkb11* KB11 CPU. enable full EIS and SPL\n\
1324 -mkd11a* KD11-A CPU. enable limited EIS\n\
1325 -mkd11b* KD11-B CPU. base line instruction set only\n\
1326 -mkd11d* KD11-D CPU. base line instruction set only\n\
1327 -mkd11e* KD11-E CPU. enable full EIS, MTPS, and MFPS\n\
1328 -mkd11f* KD11-F CPU. enable limited EIS, MTPS, and MFPS\n\
1329 -mkd11h* KD11-H CPU. enable limited EIS, MTPS, and MFPS\n\
1330 -mkd11q* KD11-Q CPU. enable limited EIS, MTPS, and MFPS\n\
1331 -mkd11k* KD11-K CPU. enable full EIS, MTPS, MFPS, LDUB, MED,\n\
1333 -mkd11z* KD11-Z CPU. enable full EIS, MTPS, MFPS, MFPT, SPL,\n\
1335 -mf11* F11 CPU. enable full EIS, MFPS, MTPS, and MFPT\n\
1336 -mj11* J11 CPU. enable full EIS, MTPS, MFPS, MFPT, SPL,\n\
1337 CSM, TSTSET, and WRTLCK\n\
1338 -mt11* T11 CPU. enable limited EIS, MTPS, and MFPS\n\
1340 PDP-11 machine model options:\n\
1342 -m11/03 same as -mkd11f\n\
1343 -m11/04 same as -mkd11d\n\
1344 -m11/05 same as -mkd11b\n\
1345 -m11/10 same as -mkd11b\n\
1346 -m11/15 same as -mka11\n\
1347 -m11/20 same as -mka11\n\
1348 -m11/21 same as -mt11\n\
1349 -m11/23 same as -mf11\n\
1350 -m11/24 same as -mf11\n\
1351 -m11/34 same as -mkd11e\n\
1352 -m11/34a same as -mkd11e -mfpp\n\
1353 -m11/35 same as -mkd11a\n\
1354 -m11/40 same as -mkd11a\n\
1355 -m11/44 same as -mkd11z\n\
1356 -m11/45 same as -mkb11\n\
1357 -m11/50 same as -mkb11\n\
1358 -m11/53 same as -mj11\n\
1359 -m11/55 same as -mkb11\n\
1360 -m11/60 same as -mkd11k\n\
1361 -m11/70 same as -mkb11\n\
1362 -m11/73 same as -mj11\n\
1363 -m11/83 same as -mj11\n\
1364 -m11/84 same as -mj11\n\
1365 -m11/93 same as -mj11\n\
1366 -m11/94 same as -mj11\n\
1371 md_undefined_symbol (char *name ATTRIBUTE_UNUSED
)
1377 md_section_align (segT segment ATTRIBUTE_UNUSED
,
1380 return (size
+ 1) & ~1;
1384 md_pcrel_from (fixS
*fixP
)
1386 return fixP
->fx_frag
->fr_address
+ fixP
->fx_where
+ fixP
->fx_size
;
1389 /* Translate internal representation of relocation info to BFD target
1393 tc_gen_reloc (asection
*section ATTRIBUTE_UNUSED
,
1397 bfd_reloc_code_real_type code
;
1399 reloc
= xmalloc (sizeof (* reloc
));
1401 reloc
->sym_ptr_ptr
= xmalloc (sizeof (asymbol
*));
1402 *reloc
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
1403 reloc
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
1405 /* This is taken account for in md_apply_fix(). */
1406 reloc
->addend
= -symbol_get_bfdsym (fixp
->fx_addsy
)->section
->vma
;
1408 switch (fixp
->fx_r_type
)
1412 code
= BFD_RELOC_16_PCREL
;
1414 code
= BFD_RELOC_16
;
1417 case BFD_RELOC_16_PCREL
:
1418 code
= BFD_RELOC_16_PCREL
;
1422 BAD_CASE (fixp
->fx_r_type
);
1426 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
, code
);
1428 if (reloc
->howto
== NULL
)
1430 as_bad_where (fixp
->fx_file
, fixp
->fx_line
,
1431 _("Can not represent %s relocation in this object file format"),
1432 bfd_get_reloc_code_name (code
));
1440 pseudo_bss (int c ATTRIBUTE_UNUSED
)
1444 temp
= get_absolute_expression ();
1445 subseg_set (bss_section
, temp
);
1446 demand_empty_rest_of_line ();
1450 pseudo_even (int c ATTRIBUTE_UNUSED
)
1452 int alignment
= 1; /* 2^1 */
1453 frag_align (alignment
, 0, 1);
1454 record_alignment (now_seg
, alignment
);
1458 md_atof (int type
, char * litP
, int * sizeP
)
1460 return vax_md_atof (type
, litP
, sizeP
);