X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-a29k.c;h=ab501645d836763eefa15bf91e0f062ab19b269a;hb=8ad30312fff34325113307cb27bcae49d220df15;hp=600fec58857cbf2c0c1d0bb00823cb6c24ab3266;hpb=04e6b63b72d72d29b1a5ff81c3a33ca75126114a;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c index 600fec5885..ab501645d8 100644 --- a/gas/config/tc-a29k.c +++ b/gas/config/tc-a29k.c @@ -1,5 +1,5 @@ /* tc-a29k.c -- Assemble for the AMD 29000. - Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 1998 + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -23,8 +23,8 @@ to convert it to new machines' assemblers as desired. There was too much bloody rewriting required before. There still probably is. */ -#include #include "as.h" +#include "safe-ctype.h" #include "opcode/a29k.h" @@ -61,6 +61,9 @@ static void machine_ip PARAMS ((char *str)); static void s_data1 PARAMS ((void)); static void s_use PARAMS ((int)); #endif +static void insert_sreg PARAMS ((char *, int)); +static void define_some_regs PARAMS ((void)); +static char *parse_operand PARAMS ((char *, expressionS *, int)); const pseudo_typeS md_pseudo_table[] = @@ -98,7 +101,7 @@ const char comment_chars[] = ";"; .line and .file directives will appear in the pre-processed output */ /* Note that input_file.c hand checks for '#' at the beginning of the first line of the input file. This is because the compiler outputs - #NO_APP at the beginning of its output. */ + #NO_APP at the beginning of its output. */ /* Also note that comments like this one will always work */ const char line_comment_chars[] = "#"; @@ -148,7 +151,7 @@ s_use (ignore) return; } /* Literals can't go in the text segment because you can't read from - instruction memory on some 29k's. So, into initialized data. */ + instruction memory on some 29k's. So, into initialized data. */ if (strncmp (input_line_pointer, ".lit", 4) == 0) { input_line_pointer += 4; @@ -188,7 +191,7 @@ insert_sreg (regname, regnum) symbol_table_insert (symbol_new (regname, SEG_REGISTER, (valueT) regnum, &zero_address_frag)); for (i = 0; regname[i]; i++) - buf[i] = islower (regname[i]) ? toupper (regname[i]) : regname[i]; + buf[i] = TOUPPER (regname[i]); buf[i] = '\0'; symbol_table_insert (symbol_new (buf, SEG_REGISTER, (valueT) regnum, @@ -198,7 +201,7 @@ insert_sreg (regname, regnum) /* Install symbol definitions for assorted special registers. See ASM29K Ref page 2-9. */ -void +static void define_some_regs () { #define SREG 256 @@ -283,7 +286,7 @@ md_begin () } /* Hack to avoid multiple opcode entries. We pre-locate all the - variations (b/i field and P/A field) and handle them. */ + variations (b/i field and P/A field) and handle them. */ if (!strcmp (name, machine_opcodes[i + 1].name)) { @@ -360,7 +363,7 @@ md_assemble (str) } } -char * +static char * parse_operand (s, operandp, opt) char *s; expressionS *operandp; @@ -397,10 +400,9 @@ machine_ip (str) /* Must handle `div0' opcode. */ s = str; - if (isalpha (*s)) - for (; isalnum (*s); ++s) - if (isupper (*s)) - *s = tolower (*s); + if (ISALPHA (*s)) + for (; ISALNUM (*s); ++s) + *s = TOLOWER (*s); switch (*s) { @@ -427,7 +429,7 @@ machine_ip (str) /* Build the opcode, checking as we go to make sure that the operands match. - + If an operand matches, we modify the_insn or opcode appropriately, and do a "continue". If an operand fails to match, we "break". */ @@ -445,7 +447,7 @@ machine_ip (str) case '\0': /* end of args */ if (*s == '\0') { - /* We are truly done. */ + /* We are truly done. */ the_insn.opcode = opcode; return; } @@ -669,7 +671,6 @@ machine_ip (str) } break; - case 'f': /* FS bits of CONVERT */ if (operand->X_op == O_constant && operand->X_add_number < 4) @@ -710,8 +711,8 @@ machine_ip (str) but I'm not sure. Turn a string in input_line_pointer into a floating point constant - of type type, and store the appropriate bytes in *litP. The number - of LITTLENUMS emitted is stored in *sizeP . An error message is + of type TYPE, and store the appropriate bytes in *LITP. The number + of LITTLENUMS emitted is stored in *SIZEP. An error message is returned, or NULL on OK. */ /* Equal to MAX_PRECISION in atof-ieee.c */ @@ -784,27 +785,25 @@ md_number_to_chars (buf, val, n) } void -md_apply_fix (fixP, val) +md_apply_fix3 (fixP, valP, seg) fixS *fixP; - long val; + valueT * valP; + segT seg ATTRIBUTE_UNUSED; { + long val = *valP; char *buf = fixP->fx_where + fixP->fx_frag->fr_literal; - fixP->fx_addnumber = val; /* Remember value for emit_reloc */ - + fixP->fx_addnumber = val; /* Remember value for emit_reloc. */ know (fixP->fx_size == 4); know (fixP->fx_r_type < NO_RELOC); /* This is a hack. There should be a better way to handle this. */ if (fixP->fx_r_type == RELOC_WDISP30 && fixP->fx_addsy) - { - val += fixP->fx_where + fixP->fx_frag->fr_address; - } + val += fixP->fx_where + fixP->fx_frag->fr_address; switch (fixP->fx_r_type) { - case RELOC_32: buf[0] = val >> 24; buf[1] = val >> 16; @@ -817,7 +816,7 @@ md_apply_fix (fixP, val) break; case RELOC_WDISP30: - val = (val >>= 2) + 1; + val = (val >> 2) + 1; buf[0] |= (val >> 24) & 0x3f; buf[1] = (val >> 16); buf[2] = val >> 8; @@ -841,7 +840,7 @@ md_apply_fix (fixP, val) break; case RELOC_WDISP22: - val = (val >>= 2) + 1; + val = (val >> 2) + 1; /* FALLTHROUGH */ case RELOC_BASE22: buf[1] |= (val >> 16) & 0x3f; @@ -866,12 +865,13 @@ md_apply_fix (fixP, val) else if (fixP->fx_pcrel) { long v = val >> 17; + if (v != 0 && v != -1) as_bad_where (fixP->fx_file, fixP->fx_line, "call/jmp target out of range"); } else - /* this case was supposed to be handled in machine_ip */ + /* This case was supposed to be handled in machine_ip. */ abort (); buf[1] = val >> 10; /* Holds bits 0003FFFC of address */ buf[3] = val >> 2; @@ -892,6 +892,9 @@ md_apply_fix (fixP, val) as_bad (_("bad relocation type: 0x%02x"), fixP->fx_r_type); break; } + + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + fixP->fx_done = 1; } #ifdef OBJ_COFF @@ -925,9 +928,9 @@ tc_coff_fix2rtype (fixP) /* should never be called for 29k */ void md_convert_frag (headers, seg, fragP) - object_headers *headers; - segT seg; - register fragS *fragP; + object_headers *headers ATTRIBUTE_UNUSED; + segT seg ATTRIBUTE_UNUSED; + register fragS *fragP ATTRIBUTE_UNUSED; { as_fatal (_("a29k_convert_frag\n")); } @@ -935,8 +938,8 @@ md_convert_frag (headers, seg, fragP) /* should never be called for a29k */ int md_estimate_size_before_relax (fragP, segtype) - register fragS *fragP; - segT segtype; + register fragS *fragP ATTRIBUTE_UNUSED; + segT segtype ATTRIBUTE_UNUSED; { as_fatal (_("a29k_estimate_size_before_relax\n")); return 0; @@ -1004,7 +1007,7 @@ print_insn (insn) 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. */ + five bits as relocation type. Next 4 bytes are long addend. */ /* Thanx and a tip of the hat to Michael Bloom, mb@ttidca.tti.com */ #ifdef OBJ_AOUT @@ -1038,23 +1041,23 @@ tc_aout_fix_to_chars (where, fixP, segment_address_in_file) #endif /* OBJ_AOUT */ -CONST char *md_shortopts = ""; +const char *md_shortopts = ""; struct option md_longopts[] = { {NULL, no_argument, NULL, 0} }; -size_t md_longopts_size = sizeof(md_longopts); +size_t md_longopts_size = sizeof (md_longopts); int md_parse_option (c, arg) - int c; - char *arg; + int c ATTRIBUTE_UNUSED; + char *arg ATTRIBUTE_UNUSED; { return 0; } void md_show_usage (stream) - FILE *stream; + FILE *stream ATTRIBUTE_UNUSED; { } @@ -1069,13 +1072,13 @@ a29k_unrecognized_line (c) char *s; if (c != '$' - || ! isdigit ((unsigned char) input_line_pointer[0])) + || ! ISDIGIT (input_line_pointer[0])) return 0; s = input_line_pointer; lab = 0; - while (isdigit ((unsigned char) *s)) + while (ISDIGIT (*s)) { lab = lab * 10 + *s - '0'; ++s; @@ -1121,7 +1124,7 @@ md_undefined_symbol (name) long maxreg; /* Parse the number, make sure it has no extra zeroes or - trailing chars. */ + trailing chars. */ regnum = atol (&name[2]); if (name[0] == 's' || name[0] == 'S') @@ -1178,7 +1181,7 @@ md_operand (expressionP) expressionP->X_op = O_constant; } else if (input_line_pointer[0] == '$' - && isdigit ((unsigned char) input_line_pointer[1])) + && ISDIGIT (input_line_pointer[1])) { long lab; char *name; @@ -1235,12 +1238,12 @@ md_operand (expressionP) type = 'x'; fieldlimit = 4; } - else + else { return; } - if (isdigit (*s)) + if (ISDIGIT (*s)) { fieldnum = *s - '0'; ++s; @@ -1266,7 +1269,7 @@ md_operand (expressionP) SKIP_WHITESPACE (); input_line_pointer = s; - expressionP->X_op = O_constant; + expressionP->X_op = O_constant; expressionP->X_unsigned = 1; expressionP->X_add_number = ((floatbuf[fieldnum * 2] << LITTLENUM_NUMBER_OF_BITS) @@ -1277,7 +1280,7 @@ md_operand (expressionP) /* Round up a section size to the appropriate boundary. */ valueT md_section_align (segment, size) - segT segment; + segT segment ATTRIBUTE_UNUSED; valueT size; { return size; /* Byte alignment is fine */ @@ -1292,5 +1295,3 @@ md_pcrel_from (fixP) { return fixP->fx_where + fixP->fx_frag->fr_address; } - -/* end of tc-a29k.c */