]> Git Repo - binutils.git/blobdiff - gas/config/tc-a29k.c
More filename renaming.
[binutils.git] / gas / config / tc-a29k.c
index cee99f922e27abdc3503966946336a90c09a6bd8..a00af02fbffc66b20cda6c40038a16df4cca7e91 100644 (file)
@@ -25,7 +25,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
 #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
@@ -88,7 +88,15 @@ md_pseudo_table[] = {
 
 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 */
@@ -534,7 +542,7 @@ machine_ip(str)
                opcode |= reg << 16;
                continue;
            }
-           abort();
+           as_fatal("failed sanity check.");
            break;
 
        case 'x':               /* 16 bit constant, zero-extended */
@@ -749,7 +757,7 @@ md_number_to_chars(buf,val,n)
        break;
 
     default:
-       abort();
+       as_fatal("failed sanity check.");
     }
     return;
 }
@@ -762,27 +770,6 @@ void md_apply_fix(fixP, val)
 
     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);
@@ -881,11 +868,15 @@ fixS *fixP;
        /* 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);
@@ -899,39 +890,15 @@ void md_create_short_jump(ptr, from_addr, to_addr, frag, to_symbol)
 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. */
-/* Thanx and a tip of the hat to Michael Bloom, [email protected] */
-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 */
@@ -942,8 +909,7 @@ void md_create_long_jump(ptr, from_addr, to_addr, frag, to_symbol)
     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 */
@@ -951,9 +917,7 @@ int md_estimate_size_before_relax(fragP, segtype)
     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
@@ -1011,48 +975,45 @@ print_insn(insn)
 }
 #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. */
+/* Thanx and a tip of the hat to Michael Bloom, [email protected] */
 
-       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 */
 
@@ -1062,7 +1023,7 @@ md_parse_option(argP,cntP,vecP)
     int *cntP;
     char ***vecP;
 {
-    return 1;
+    return(0);
 }
 
 
This page took 0.029363 seconds and 4 git commands to generate.