X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-m68k.c;h=20c9c107b58ec6d6ede3d093a21f4832e98d43c6;hb=bbe8ef22ff5ff90692a87e3d5f4f3aa135bd7a03;hp=32e18f7427d1ffcf649ba61a677d357148960a44;hpb=f27a38390b050e2b546c5265806979bd5203c95c;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 32e18f7427..20c9c107b5 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -20,8 +20,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include "as.h" +#include "safe-ctype.h" #include "obstack.h" #include "subsegs.h" #include "dwarf2dbg.h" @@ -257,9 +257,9 @@ insop (w, opcode) const struct m68k_incant *opcode; { int z; - for(z=the_ins.numo;z>opcode->m_codenum;--z) + for (z = the_ins.numo; z > opcode->m_codenum; --z) the_ins.opcode[z]=the_ins.opcode[z-1]; - for(z=0;zdisp) == 0) { if (the_ins.opcode[0] == 0x6000) /* jbra */ - the_ins.opcode[0] = 0x4EF1; + the_ins.opcode[0] = 0x4EF9; else if (the_ins.opcode[0] == 0x6100) /* jbsr */ - the_ins.opcode[0] = 0x4EB1; + the_ins.opcode[0] = 0x4EB9; else /* jCC */ { the_ins.opcode[0] ^= 0x0100; the_ins.opcode[0] |= 0x0006; - addword (0x4EF1); + addword (0x4EF9); } add_fix ('l', &opP->disp, 0, 0); addword (0); @@ -3316,7 +3308,7 @@ insert_reg (regname, 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, reg_section, regnum, @@ -3786,11 +3778,10 @@ md_begin () my lord ghod hath spoken, so we do it this way. Excuse the ugly var names. */ - register const struct m68k_opcode *ins; - register struct m68k_incant *hack, *slak; - register const char *retval = 0; /* empty string, or error msg text */ - register int i; - register char c; + const struct m68k_opcode *ins; + struct m68k_incant *hack, *slak; + const char *retval = 0; /* empty string, or error msg text */ + int i; if (flag_mri) { @@ -3885,9 +3876,6 @@ md_begin () } } - for (i = 0; i < (int) sizeof (mklower_table); i++) - mklower_table[i] = (isupper (c = (char) i)) ? tolower (c) : c; - for (i = 0; i < (int) sizeof (notend_table); i++) { notend_table[i] = 0; @@ -4233,11 +4221,13 @@ md_number_to_chars (buf, val, n) number_to_chars_bigendian (buf, val, n); } -static void -md_apply_fix_2 (fixP, val) +void +md_apply_fix3 (fixP, valP, seg) fixS *fixP; - offsetT val; + valueT *valP; + segT seg ATTRIBUTE_UNUSED; { + offsetT val = *valP; addressT upper_limit; offsetT lower_limit; @@ -4249,6 +4239,9 @@ md_apply_fix_2 (fixP, val) val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; + if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0) + fixP->fx_done = 1; + #ifdef OBJ_ELF if (fixP->fx_addsy) { @@ -4271,8 +4264,8 @@ md_apply_fix_2 (fixP, val) switch (fixP->fx_size) { - /* The cast to offsetT below are necessary to make code correct for - machines where ints are smaller than offsetT */ + /* The cast to offsetT below are necessary to make code + correct for machines where ints are smaller than offsetT. */ case 1: *buf++ = val; upper_limit = 0x7f; @@ -4332,24 +4325,6 @@ md_apply_fix_2 (fixP, val) as_bad_where (fixP->fx_file, fixP->fx_line, _("invalid byte branch offset")); } -#ifdef BFD_ASSEMBLER -int -md_apply_fix (fixP, valp) - fixS *fixP; - valueT *valp; -{ - md_apply_fix_2 (fixP, (addressT) *valp); - return 1; -} -#else -void md_apply_fix (fixP, val) - fixS *fixP; - long val; -{ - md_apply_fix_2 (fixP, (addressT) val); -} -#endif - /* *fragP has been relaxed to its final size, and now needs to have the bytes inside it modified to conform to the new size There is UGLY MAGIC here. .. @@ -4375,10 +4350,6 @@ md_convert_frag_1 (fragP) disp = fragP->fr_symbol ? S_GET_VALUE (fragP->fr_symbol) : 0; disp = (disp + fragP->fr_offset) - object_address; -#ifdef BFD_ASSEMBLER - disp += symbol_get_frag (fragP->fr_symbol)->fr_address; -#endif - switch (fragP->fr_subtype) { case TAB (BRANCHBWL, BYTE): @@ -4594,10 +4565,6 @@ md_estimate_size_before_relax (fragP, segment) register fragS *fragP; segT segment; { - int old_fix; - - old_fix = fragP->fr_fix; - /* Handle SZ_UNDEF first, it can be changed to BYTE or SHORT. */ switch (fragP->fr_subtype) { @@ -4694,44 +4661,31 @@ md_estimate_size_before_relax (fragP, segment) case TAB (BRABSJCOND, BYTE): case TAB (BRANCHBW, BYTE): /* We can't do a short jump to the next instruction, so in that - case we force word mode. At this point S_GET_VALUE should - return the offset of the symbol within its frag. If the - symbol is at the start of a frag, and it is the next frag - with any data in it (usually this is just the next frag, but - assembler listings may introduce empty frags), we must use - word mode. */ - if (fragP->fr_symbol && S_GET_VALUE (fragP->fr_symbol) == 0) + case we force word mode. If the symbol is at the start of a + frag, and it is the next frag with any data in it (usually + this is just the next frag, but assembler listings may + introduce empty frags), we must use word mode. */ + if (fragP->fr_symbol) { - fragS *stop; - fragS *l; + fragS *sym_frag; - stop = symbol_get_frag (fragP->fr_symbol); - - for (l = fragP->fr_next; l != stop; l = l->fr_next) + sym_frag = symbol_get_frag (fragP->fr_symbol); + if (S_GET_VALUE (fragP->fr_symbol) == sym_frag->fr_address) { - /* Catch empty alignment frags whoes fr_offset field - is an alignment requirement of 2 bytes. The check - below will misinterpret this as evidence that real - code exists between the symbol and the instruction - and so will not convert the short jump into a word - jump. */ - if (l->fr_fix == 0 - && l->fr_var == 1 - && (l->fr_type == rs_align || l->fr_type == rs_align_code)) - continue; - - if (l->fr_fix + l->fr_var != 0) - break; + fragS *l; + + for (l = fragP->fr_next; l != sym_frag; l = l->fr_next) + if (l->fr_fix != 0) + break; + if (l == sym_frag) + fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT); } - if (l == stop) - fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT); } break; default: break; } - fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length; - return fragP->fr_var + fragP->fr_fix - old_fix; + return md_relax_table[fragP->fr_subtype].rlx_length; } #if defined(OBJ_AOUT) | defined(OBJ_BOUT) @@ -5396,7 +5350,7 @@ s_reg (ignore) SKIP_WHITESPACE (); s = input_line_pointer; - while (isalnum ((unsigned char) *input_line_pointer) + while (ISALNUM (*input_line_pointer) #ifdef REGISTER_PREFIX || *input_line_pointer == REGISTER_PREFIX #endif @@ -5608,10 +5562,7 @@ mri_assemble (str) /* md_assemble expects the opcode to be in lower case. */ for (s = str; *s != ' ' && *s != '\0'; s++) - { - if (isupper ((unsigned char) *s)) - *s = tolower ((unsigned char) *s); - } + *s = TOLOWER (*s); md_assemble (str); } @@ -5693,10 +5644,8 @@ parse_mri_condition (pcc) ++input_line_pointer; SKIP_WHITESPACE (); - if (isupper (c1)) - c1 = tolower (c1); - if (isupper (c2)) - c2 = tolower (c2); + c1 = TOLOWER (c1); + c2 = TOLOWER (c2); *pcc = (c1 << 8) | c2; @@ -5938,7 +5887,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart, *s++ = 'm'; *s++ = 'p'; if (qual != '\0') - *s++ = tolower(qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, leftstart, leftstop - leftstart); s += leftstop - leftstart; @@ -5956,7 +5905,7 @@ build_mri_control_operand (qual, cc, leftstart, leftstop, rightstart, *s++ = cc >> 8; *s++ = cc & 0xff; if (extent != '\0') - *s++ = tolower(extent); + *s++ = TOLOWER (extent); *s++ = ' '; strcpy (s, truelab); mri_assemble (buf); @@ -6206,7 +6155,7 @@ s_mri_else (qual) mri_control_stack->else_seen = 1; buf = (char *) xmalloc (20 + strlen (mri_control_stack->bottom)); - q[0] = tolower(qual); + q[0] = TOLOWER (qual); q[1] = '\0'; sprintf (buf, "bra%s %s", q, mri_control_stack->bottom); mri_assemble (buf); @@ -6279,7 +6228,7 @@ s_mri_break (extent) } buf = (char *) xmalloc (20 + strlen (n->bottom)); - ex[0] = tolower(extent); + ex[0] = TOLOWER (extent); ex[1] = '\0'; sprintf (buf, "bra%s %s", ex, n->bottom); mri_assemble (buf); @@ -6318,7 +6267,7 @@ s_mri_next (extent) } buf = (char *) xmalloc (20 + strlen (n->next)); - ex[0] = tolower(extent); + ex[0] = TOLOWER (extent); ex[1] = '\0'; sprintf (buf, "bra%s %s", ex, n->next); mri_assemble (buf); @@ -6502,7 +6451,7 @@ s_mri_for (qual) *s++ = 'v'; *s++ = 'e'; if (qual != '\0') - *s++ = tolower(qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, initstart, initstop - initstart); s += initstop - initstart; @@ -6520,7 +6469,7 @@ s_mri_for (qual) *s++ = 'm'; *s++ = 'p'; if (qual != '\0') - *s++ = tolower(qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, endstart, endstop - endstart); s += endstop - endstart; @@ -6531,7 +6480,7 @@ s_mri_for (qual) mri_assemble (buf); /* bcc bottom */ - ex[0] = tolower(extent); + ex[0] = TOLOWER (extent); ex[1] = '\0'; if (up) sprintf (buf, "blt%s %s", ex, n->bottom); @@ -6547,7 +6496,7 @@ s_mri_for (qual) strcpy (s, "sub"); s += 3; if (qual != '\0') - *s++ = tolower(qual); + *s++ = TOLOWER (qual); *s++ = ' '; memcpy (s, bystart, bystop - bystart); s += bystop - bystart;