- {
- /* Stack global
- arg: cs symbol name
-
- stack 32 bit value of symbol (high bits set to 0). */
- case ETIR__C_STA_GBL:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
- _bfd_vms_push (abfd, op1, alpha_vms_sym_to_ctxt (h));
- break;
-
- /* Stack longword
- arg: lw value
-
- stack 32 bit value, sign extend to 64 bit. */
- case ETIR__C_STA_LW:
- _bfd_vms_push (abfd, bfd_getl32 (ptr), RELC_NONE);
- break;
-
- /* Stack quadword
- arg: qw value
-
- stack 64 bit value of symbol. */
- case ETIR__C_STA_QW:
- _bfd_vms_push (abfd, bfd_getl64 (ptr), RELC_NONE);
- break;
-
- /* Stack psect base plus quadword offset
- arg: lw section index
- qw signed quadword offset (low 32 bits)
-
- Stack qw argument and section index
- (see ETIR__C_STO_OFF, ETIR__C_CTL_SETRB). */
- case ETIR__C_STA_PQ:
- {
- int psect;
-
- psect = bfd_getl32 (ptr);
- if ((unsigned int) psect >= PRIV (section_count))
- {
- (*_bfd_error_handler) (_("bad section index in %s"),
- _bfd_vms_etir_name (cmd));
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- op1 = bfd_getl64 (ptr + 4);
- _bfd_vms_push (abfd, op1, psect | RELC_SEC_BASE);
- }
- break;
-
- case ETIR__C_STA_LI:
- case ETIR__C_STA_MOD:
- case ETIR__C_STA_CKARG:
- (*_bfd_error_handler) (_("unsupported STA cmd %s"),
- _bfd_vms_etir_name (cmd));
- return FALSE;
- break;
-
- /* Store byte: pop stack, write byte
- arg: -. */
- case ETIR__C_STO_B:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- image_write_b (abfd, (unsigned int) op1 & 0xff);
- break;
-
- /* Store word: pop stack, write word
- arg: -. */
- case ETIR__C_STO_W:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- image_write_w (abfd, (unsigned int) op1 & 0xffff);
- break;
-
- /* Store longword: pop stack, write longword
- arg: -. */
- case ETIR__C_STO_LW:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 & RELC_SEC_BASE)
- {
- op1 = alpha_vms_fix_sec_rel (abfd, info, rel1, op1);
- rel1 = RELC_REL;
- }
- else if (rel1 & RELC_SHR_BASE)
- {
- alpha_vms_add_fixup_lr (info, rel1 & RELC_MASK, op1);
- rel1 = RELC_NONE;
- }
- if (rel1 != RELC_NONE)
- {
- if (rel1 != RELC_REL)
- abort ();
- alpha_vms_add_lw_reloc (info);
- }
- image_write_l (abfd, op1);
- break;
-
- /* Store quadword: pop stack, write quadword
- arg: -. */
- case ETIR__C_STO_QW:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 & RELC_SEC_BASE)
- {
- op1 = alpha_vms_fix_sec_rel (abfd, info, rel1, op1);
- rel1 = RELC_REL;
- }
- else if (rel1 & RELC_SHR_BASE)
- abort ();
- if (rel1 != RELC_NONE)
- {
- if (rel1 != RELC_REL)
- abort ();
- alpha_vms_add_qw_reloc (info);
- }
- image_write_q (abfd, op1);
- break;
-
- /* Store immediate repeated: pop stack for repeat count
- arg: lw byte count
- da data. */
- case ETIR__C_STO_IMMR:
- {
- int size;
-
- size = bfd_getl32 (ptr);
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- while (op1-- > 0)
- image_write (abfd, ptr + 4, size);
- }
- break;
-
- /* Store global: write symbol value
- arg: cs global symbol name. */
- case ETIR__C_STO_GBL:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
- if (h && h->sym)
- {
- if (h->sym->typ == EGSD__C_SYMG)
- {
- alpha_vms_add_fixup_qr
- (info, abfd, h->sym->owner, h->sym->symbol_vector);
- op1 = 0;
- }
- else
- {
- op1 = alpha_vms_get_sym_value (h->sym->section,
- h->sym->value);
- alpha_vms_add_qw_reloc (info);
- }
- }
- image_write_q (abfd, op1);
- break;
-
- /* Store code address: write address of entry point
- arg: cs global symbol name (procedure). */
- case ETIR__C_STO_CA:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
- if (h && h->sym)
- {
- if (h->sym->flags & EGSY__V_NORM)
- {
- /* That's really a procedure. */
- if (h->sym->typ == EGSD__C_SYMG)
- {
- alpha_vms_add_fixup_ca (info, abfd, h->sym->owner);
- op1 = h->sym->symbol_vector;
- }
- else
- {
- op1 = alpha_vms_get_sym_value (h->sym->code_section,
- h->sym->code_value);
- alpha_vms_add_qw_reloc (info);
- }
- }
- else
- {
- /* Symbol is not a procedure. */
- abort ();
- }
- }
- image_write_q (abfd, op1);
- break;
-
- /* Store offset to psect: pop stack, add low 32 bits to base of psect
- arg: none. */
- case ETIR__C_STO_OFF:
- _bfd_vms_pop (abfd, &op1, &rel1);
-
- if (!(rel1 & RELC_SEC_BASE))
- abort ();
-
- op1 = alpha_vms_fix_sec_rel (abfd, info, rel1, op1);
- rel1 = RELC_REL;
- image_write_q (abfd, op1);
- break;
-
- /* Store immediate
- arg: lw count of bytes
- da data. */
- case ETIR__C_STO_IMM:
- {
- int size;
-
- size = bfd_getl32 (ptr);
- image_write (abfd, ptr + 4, size);
- }
- break;
-
- /* This code is 'reserved to digital' according to the openVMS
- linker manual, however it is generated by the DEC C compiler
- and defined in the include file.
- FIXME, since the following is just a guess
- store global longword: store 32bit value of symbol
- arg: cs symbol name. */
- case ETIR__C_STO_GBL_LW:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
-#if 0
- abort ();
-#endif
- image_write_l (abfd, op1);
- break;
-
- case ETIR__C_STO_RB:
- case ETIR__C_STO_AB:
- case ETIR__C_STO_LP_PSB:
- (*_bfd_error_handler) (_("%s: not supported"),
- _bfd_vms_etir_name (cmd));
- return FALSE;
- break;
- case ETIR__C_STO_HINT_GBL:
- case ETIR__C_STO_HINT_PS:
- (*_bfd_error_handler) (_("%s: not implemented"),
- _bfd_vms_etir_name (cmd));
- return FALSE;
- break;
-
- /* 200 Store-conditional Linkage Pair
- arg: none. */
- case ETIR__C_STC_LP:
-
- /* 202 Store-conditional Address at global address
- lw linkage index
- cs global name. */
-
- case ETIR__C_STC_GBL:
-
- /* 203 Store-conditional Code Address at global address
- lw linkage index
- cs procedure name. */
- case ETIR__C_STC_GCA:
-
- /* 204 Store-conditional Address at psect + offset
- lw linkage index
- lw psect index
- qw offset. */
- case ETIR__C_STC_PS:
- (*_bfd_error_handler) (_("%s: not supported"),
- _bfd_vms_etir_name (cmd));
- return FALSE;
- break;
-
- /* 201 Store-conditional Linkage Pair with Procedure Signature
- lw linkage index
- cs procedure name
- by signature length
- da signature. */
-
- case ETIR__C_STC_LP_PSB:
- _bfd_vms_get_value (abfd, ptr + 4, info, &op1, &h);
- if (h && h->sym)
- {
- if (h->sym->typ == EGSD__C_SYMG)
- {
- alpha_vms_add_fixup_lp (info, abfd, h->sym->owner);
- op1 = h->sym->symbol_vector;
- op2 = 0;
- }
- else
- {
- op1 = alpha_vms_get_sym_value (h->sym->code_section,
- h->sym->code_value);
- op2 = alpha_vms_get_sym_value (h->sym->section,
- h->sym->value);
- }
- }
- else
- {
- /* Undefined symbol. */
- op1 = 0;
- op2 = 0;
- }
- image_write_q (abfd, op1);
- image_write_q (abfd, op2);
- break;
-
- /* 205 Store-conditional NOP at address of global
- arg: none. */
- case ETIR__C_STC_NOP_GBL:
- /* ALPHA_R_NOP */
-
- /* 207 Store-conditional BSR at global address
- arg: none. */
-
- case ETIR__C_STC_BSR_GBL:
- /* ALPHA_R_BSR */
-
- /* 209 Store-conditional LDA at global address
- arg: none. */
-
- case ETIR__C_STC_LDA_GBL:
- /* ALPHA_R_LDA */
-
- /* 211 Store-conditional BSR or Hint at global address
- arg: none. */
-
- case ETIR__C_STC_BOH_GBL:
- /* Currentl ignored. */
- break;
-
- /* 213 Store-conditional NOP,BSR or HINT at global address
- arg: none. */
-
- case ETIR__C_STC_NBH_GBL:
-
- /* 206 Store-conditional NOP at pect + offset
- arg: none. */
-
- case ETIR__C_STC_NOP_PS:
-
- /* 208 Store-conditional BSR at pect + offset
- arg: none. */
-
- case ETIR__C_STC_BSR_PS:
-
- /* 210 Store-conditional LDA at psect + offset
- arg: none. */
-
- case ETIR__C_STC_LDA_PS:
-
- /* 212 Store-conditional BSR or Hint at pect + offset
- arg: none. */
-
- case ETIR__C_STC_BOH_PS:
-
- /* 214 Store-conditional NOP, BSR or HINT at psect + offset
- arg: none. */
- case ETIR__C_STC_NBH_PS:
- (*_bfd_error_handler) ("%s: not supported",
- _bfd_vms_etir_name (cmd));
- return FALSE;
- break;
-
- /* Det relocation base: pop stack, set image location counter
- arg: none. */
- case ETIR__C_CTL_SETRB:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (!(rel1 & RELC_SEC_BASE))
- abort ();
- image_set_ptr (abfd, op1, rel1 & RELC_MASK, info);
- break;
-
- /* Augment relocation base: increment image location counter by offset
- arg: lw offset value. */
- case ETIR__C_CTL_AUGRB:
- op1 = bfd_getl32 (ptr);
- image_inc_ptr (abfd, op1);
- break;
-
- /* Define location: pop index, save location counter under index
- arg: none. */
- case ETIR__C_CTL_DFLOC:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- dst_define_location (abfd, op1);
- break;
-
- /* Set location: pop index, restore location counter from index
- arg: none. */
- case ETIR__C_CTL_STLOC:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- dst_restore_location (abfd, op1);
- break;
-
- /* Stack defined location: pop index, push location counter from index
- arg: none. */
- case ETIR__C_CTL_STKDL:
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, dst_retrieve_location (abfd, op1), RELC_NONE);
- break;
-
- case ETIR__C_OPR_NOP: /* No-op. */
- break;
-
- case ETIR__C_OPR_ADD: /* Add. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 == RELC_NONE && rel2 != RELC_NONE)
- rel1 = rel2;
- else if (rel1 != RELC_NONE && rel2 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, op1 + op2, rel1);
- break;
-
- case ETIR__C_OPR_SUB: /* Subtract. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 == RELC_NONE && rel2 != RELC_NONE)
- rel1 = rel2;
- else if ((rel1 & RELC_SEC_BASE) && (rel2 & RELC_SEC_BASE))
- {
- op1 = alpha_vms_fix_sec_rel (abfd, info, rel1, op1);
- op2 = alpha_vms_fix_sec_rel (abfd, info, rel2, op2);
- rel1 = RELC_NONE;
- }
- else if (rel1 != RELC_NONE && rel2 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, op2 - op1, rel1);
- break;
-
- case ETIR__C_OPR_MUL: /* Multiply. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 != RELC_NONE || rel2 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, op1 * op2, RELC_NONE);
- break;
-
- case ETIR__C_OPR_DIV: /* Divide. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 != RELC_NONE || rel2 != RELC_NONE)
- goto bad_context;
- if (op2 == 0)
- _bfd_vms_push (abfd, 0, RELC_NONE);
- else
- _bfd_vms_push (abfd, op2 / op1, RELC_NONE);
- break;
-
- case ETIR__C_OPR_AND: /* Logical AND. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 != RELC_NONE || rel2 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, op1 & op2, RELC_NONE);
- break;
-
- case ETIR__C_OPR_IOR: /* Logical inclusive OR. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 != RELC_NONE || rel2 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, op1 | op2, RELC_NONE);
- break;
-
- case ETIR__C_OPR_EOR: /* Logical exclusive OR. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 != RELC_NONE || rel2 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, op1 ^ op2, RELC_NONE);
- break;
-
- case ETIR__C_OPR_NEG: /* Negate. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, -op1, RELC_NONE);
- break;
-
- case ETIR__C_OPR_COM: /* Complement. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (rel1 != RELC_NONE)
- goto bad_context;
- _bfd_vms_push (abfd, ~op1, RELC_NONE);
- break;
-
- case ETIR__C_OPR_ASH: /* Arithmetic shift. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- if (rel1 != RELC_NONE || rel2 != RELC_NONE)
- {
- bad_context:
- (*_bfd_error_handler) (_("invalid use of %s with contexts"),
- _bfd_vms_etir_name (cmd));
- return FALSE;
- }
- if ((int)op2 < 0) /* Shift right. */
- op1 >>= -(int)op2;
- else /* Shift left. */
- op1 <<= (int)op2;
- _bfd_vms_push (abfd, op1, RELC_NONE); /* FIXME: sym. */
- break;
-
- case ETIR__C_OPR_INSV: /* Insert field. */
- case ETIR__C_OPR_USH: /* Unsigned shift. */
- case ETIR__C_OPR_ROT: /* Rotate. */
- case ETIR__C_OPR_REDEF: /* Redefine symbol to current location. */
- case ETIR__C_OPR_DFLIT: /* Define a literal. */
- (*_bfd_error_handler) (_("%s: not supported"),
- _bfd_vms_etir_name (cmd));
- return FALSE;
- break;
-
- case ETIR__C_OPR_SEL: /* Select. */
- _bfd_vms_pop (abfd, &op1, &rel1);
- if (op1 & 0x01L)
- _bfd_vms_pop (abfd, &op1, &rel1);
- else
- {
- _bfd_vms_pop (abfd, &op1, &rel1);
- _bfd_vms_pop (abfd, &op2, &rel2);
- _bfd_vms_push (abfd, op1, rel1);
- }
- break;
-
- default:
- (*_bfd_error_handler) (_("reserved cmd %d"), cmd);
- return FALSE;
- break;
- }
-
- ptr += cmd_length - 4;
- }