#include "as.h"
-#include "a29k-opcode.h"
+#include "opcode/a29k.h"
/* Make it easier to clone this machine desc into another one. */
#define machine_opcode a29k_opcode
int md_short_jump_size = 4;
int md_long_jump_size = 4;
-int md_reloc_size = 12;
+#if defined(BFD_HEADERS)
+#ifdef RELSZ
+int md_reloc_size = RELSZ; /* Coff headers */
+#else
+int md_reloc_size = 12; /* something else headers */
+#endif
+#else
+int md_reloc_size = 12; /* Not bfdized*/
+#endif
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful */
opcode |= reg << 16;
continue;
}
- abort();
+ as_fatal("failed sanity check.");
break;
case 'x': /* 16 bit constant, zero-extended */
break;
default:
- abort();
+ as_fatal("failed sanity check.");
}
return;
}
fixP->fx_addnumber = val; /* Remember value for emit_reloc */
- if (fixP->fx_r_type == NO_RELOC) {
- abort(); /* FIXME-SOON, if this is never used, remove */
- switch (fixP->fx_size) {
- case 1:
- *buf = val;
- break;
- case 2:
- *buf++ = (val>>8);
- *buf = val;
- break;
- case 4:
- *buf++ = (val>>24);
- *buf++ = (val>>16);
- *buf++ = (val>>8);
- *buf = val;
- break;
- default:
- abort();
- }
- return;
- }
know(fixP->fx_size == 4);
know(fixP->fx_r_type < NO_RELOC);
/* FIXME-NOW: relocation type handling is not yet written for
a29k. */
- know(0);
+
switch (fixP->fx_r_type) {
case RELOC_32: return(R_WORD);
case RELOC_8: return(R_BYTE);
- default: know(0);
+ case RELOC_CONST: return (R_ILOHALF);
+ case RELOC_CONSTH: return (R_IHIHALF);
+ case RELOC_JUMPTARG: return (R_IREL);
+ default: printf("need %o3\n", fixP->fx_r_type);
+ abort(0);
} /* switch on type */
return(0);
fragS *frag;
symbolS *to_symbol;
{
- fprintf(stderr, "a29k_create_short_jmp\n");
- abort();
-}
-
-/* Translate internal representation of relocation info to target format.
-
- On sparc/29k: first 4 bytes are normal unsigned long address, next three
- bytes are index, most sig. byte first. Byte 7 is broken up with
- bit 7 as external, bits 6 & 5 unused, and the lower
- five bits as relocation type. Next 4 bytes are long addend. */
-void
-md_ri_to_chars(the_bytes, ri)
- char *the_bytes;
- struct reloc_info_generic *ri;
-{
- /* this is easy */
- md_number_to_chars(the_bytes, ri->r_address, 4);
- /* now the fun stuff */
- the_bytes[4] = (ri->r_index >> 16) & 0x0ff;
- the_bytes[5] = (ri->r_index >> 8) & 0x0ff;
- the_bytes[6] = ri->r_index & 0x0ff;
- the_bytes[7] = ((ri->r_extern << 7) & 0x80) | (0 & 0x60) | (ri->r_type & 0x1F);
- /* Also easy */
- md_number_to_chars(&the_bytes[8], ri->r_addend, 4);
+ as_fatal("a29k_create_short_jmp\n");
}
/* should never be called for 29k */
-void md_convert_frag(fragP)
+void md_convert_frag(headers, fragP)
+object_headers *headers;
register fragS *fragP;
{
- fprintf(stderr, "sparc_convert_frag\n");
- abort();
+ as_fatal("sparc_convert_frag\n");
}
/* should never be called for 29k */
fragS *frag;
symbolS *to_symbol;
{
- fprintf(stderr, "sparc_create_long_jump\n");
- abort();
+ as_fatal("sparc_create_long_jump\n");
}
/* should never be called for sparc */
register fragS *fragP;
segT segtype;
{
- fprintf(stderr, "sparc_estimate_size_before_relax\n");
- abort();
- return 0;
+ as_fatal("sparc_estimate_size_before_relax\n");
}
#if 0
}
#endif
-/*
- * Sparc/A29K relocations are completely different, so it needs
- * this machine dependent routine to emit them.
- */
-#ifdef OBJ_AOUT
-static void emit_machine_reloc(fixP, segment_address_in_file)
-register fixS *fixP;
-relax_addressT segment_address_in_file;
-{
- struct reloc_info_generic ri;
- register symbolS *symbolP;
- extern char *next_object_file_charP;
-/* !!!! long add_number; */
-
- bzero((char *) &ri, sizeof(ri));
- for (; fixP; fixP = fixP->fx_next) {
+/* Translate internal representation of relocation info to target format.
- if (fixP->fx_r_type >= NO_RELOC) {
- fprintf(stderr, "fixP->fx_r_type = %d\n", fixP->fx_r_type);
- abort();
- }
+ On sparc/29k: first 4 bytes are normal unsigned long address, next three
+ bytes are index, most sig. byte first. Byte 7 is broken up with
+ bit 7 as external, bits 6 & 5 unused, and the lower
+ five bits as relocation type. Next 4 bytes are long addend. */
- if ((symbolP = fixP->fx_addsy) != NULL) {
- ri.r_address = fixP->fx_frag->fr_address +
- fixP->fx_where - segment_address_in_file;
- ri.r_addend = fixP->fx_addnumber;
- if (!S_IS_DEFINED(symbolP)) {
- ri.r_extern = 1;
- ri.r_index = symbolP->sy_number;
- } else {
- ri.r_extern = 0;
- ri.r_index = S_GET_TYPE(symbolP);
- }
- ri.r_type = fixP->fx_r_type;
+#ifdef OBJ_AOUT
- md_ri_to_chars (next_object_file_charP, &ri);
- next_object_file_charP += md_reloc_size;
- }
- }
-} /* emit_machine_reloc() */
+void tc_aout_fix_to_chars(where, fixP, segment_address_in_file)
+char *where;
+fixS *fixP;
+relax_addressT segment_address_in_file;
+{
+ long r_index;
+
+ know(fixP->fx_r_type < NO_RELOC);
+ know(fixP->fx_addsy != NULL);
+
+ r_index = (S_IS_DEFINED(fixP->fx_addsy)
+ ? S_GET_TYPE(fixP->fx_addsy)
+ : fixP->fx_addsy->sy_number);
+
+ /* this is easy */
+ md_number_to_chars(where,
+ fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file,
+ 4);
+
+ /* now the fun stuff */
+ where[4] = (r_index >> 16) & 0x0ff;
+ where[5] = (r_index >> 8) & 0x0ff;
+ where[6] = r_index & 0x0ff;
+ where[7] = (((!S_IS_DEFINED(fixP->fx_addsy)) << 7) & 0x80) | (0 & 0x60) | (fixP->fx_r_type & 0x1F);
+ /* Also easy */
+ md_number_to_chars(&where[8], fixP->fx_addnumber, 4);
-void (*md_emit_relocations)() = emit_machine_reloc;
+ return;
+} /* tc_aout_fix_to_chars() */
#endif /* OBJ_AOUT */
int *cntP;
char ***vecP;
{
- return 1;
+ return(0);
}