Flag error if absolute constant is too large for an immediate field.
[deliverable/binutils-gdb.git] / gas / config / tc-a29k.c
index 1111d03814c243bf141f05542d6bb942a1992dcc..5d7c0465c87c6925f617351be87ae393b20d584d 100644 (file)
@@ -48,10 +48,13 @@ struct machine_it {
        expressionS exp;
        int pcrel;
        int  reloc_offset;              /* Offset of reloc within insn */
-       enum reloc_type reloc;
+
+       int reloc;
+
+
 } the_insn;
 
-#ifdef __STDC__
+#if __STDC__ == 1
 
 /* static int getExpression(char *str); */
 static void machine_ip(char *str);
@@ -59,7 +62,7 @@ static void machine_ip(char *str);
 static void s_data1(void);
 static void s_use(void);
 
-#else /* __STDC__ */
+#else /* not __STDC__ */
 
 /* static int getExpression(); */
 static void machine_ip();
@@ -67,7 +70,7 @@ static void machine_ip();
 static void s_data1();
 static void s_use();
 
-#endif /* __STDC__ */
+#endif /* not __STDC__ */
 
 const pseudo_typeS
     md_pseudo_table[] = {
@@ -77,7 +80,10 @@ const pseudo_typeS
            { "reg",    s_lsym,         0 },    /* Register equate, same as equ */
            { "space",  s_ignore,       0 },    /* Listing control */
            { "sect",   s_ignore,       0 },    /* Creation of coff sections */
+#ifndef OBJ_COFF
+ /* We can do this right with coff */
            { "use",    s_use,          0 },
+#endif
            { "word",   cons,           4 },
            { NULL,     0,              0 },
     };
@@ -362,34 +368,18 @@ char *
 char *s;
 expressionS *operandp;
 {
-       char *save = input_line_pointer;
-       char *new;
-       segT seg;
+  char *save = input_line_pointer;
+  char *new;
+  segT seg;
        
-       input_line_pointer = s;
-       seg = expr (0, operandp);
-       new = input_line_pointer;
-       input_line_pointer = save;
-       
-       switch (seg) {
-       case SEG_ABSOLUTE:
-       case SEG_TEXT:
-       case SEG_DATA:
-       case SEG_BSS:
-       case SEG_UNKNOWN:
-       case SEG_DIFFERENCE:
-       case SEG_BIG:
-       case SEG_REGISTER:
-               return new;
-               
-       case SEG_ABSENT:
-               as_bad("Missing operand");
-               return new;
-               
-       default:
-               as_bad("Don't understand operand of type %s", segment_name (seg));
-               return new;
-       }
+  input_line_pointer = s;
+  seg = expr (0, operandp);
+  new = input_line_pointer;
+  input_line_pointer = save;
+
+  if (seg == SEG_ABSENT)       
+   as_bad("Missing operand");
+  return new;
 }
 
 /* Instruction parsing.  Takes a string containing the opcode.  
@@ -437,7 +427,7 @@ char *str;
        }
        argsStart = s;
        opcode = insn->opcode;
-       bzero(&the_insn, sizeof(the_insn));
+       memset(&the_insn, '\0', sizeof(the_insn));
        the_insn.reloc = NO_RELOC;
        
        /*
@@ -861,10 +851,6 @@ short tc_coff_fix2rtype(fixP)
 fixS *fixP;
 {
        
-       /* FIXME-NOW: relocation type handling is not yet written for
-          a29k. */
-       
-       
        switch (fixP->fx_r_type) {
        case RELOC_32:  return(R_WORD);
        case RELOC_8:   return(R_BYTE);
@@ -872,7 +858,7 @@ fixS *fixP;
        case RELOC_CONSTH: return (R_IHIHALF);
        case RELOC_JUMPTARG: return (R_IREL);
        default:        printf("need %o3\n", fixP->fx_r_type);
-               abort(0);
+               abort();
        } /* switch on type */
        
        return(0);
@@ -900,20 +886,21 @@ register fragS *fragP;
 /* should never be called for 29k */
 void md_create_long_jump(ptr, from_addr, to_addr, frag, to_symbol)
 char   *ptr;
-long   from_addr,
-    to_addr;
+long   from_addr;
+long    to_addr;
 fragS  *frag;
 symbolS        *to_symbol;
 {
        as_fatal("sparc_create_long_jump\n");
 }
 
-/* should never be called for sparc */
+/* should never be called for a29k */
 int md_estimate_size_before_relax(fragP, segtype)
 register fragS *fragP;
 segT segtype;
 {
        as_fatal("sparc_estimate_size_before_relax\n");
+       return(0);
 }
 
 #if 0
@@ -986,24 +973,22 @@ char *where;
 fixS *fixP;
 relax_addressT segment_address_in_file;
 {
-       long r_index;
+       long r_symbolnum;
        
        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;
+       r_symbolnum = (S_IS_DEFINED(fixP->fx_addsy)
+                      ? S_GET_TYPE(fixP->fx_addsy)
+                      : fixP->fx_addsy->sy_number);
+       
+       where[4] = (r_symbolnum >> 16) & 0x0ff;
+       where[5] = (r_symbolnum >> 8) & 0x0ff;
+       where[6] = r_symbolnum & 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);
This page took 0.025553 seconds and 4 git commands to generate.