diff options
author | Alan Modra <amodra@gmail.com> | 2019-04-15 21:51:44 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-04-16 17:12:09 +0930 |
commit | 871a6bd2d852b0fb677386e1be78c3f4c6939b48 (patch) | |
tree | f1a378f0c442384f758827ba5c8f5a85ca83d3bd /gas/config | |
parent | 02e902e1a1ec7b74125f329b3faef1992efb6d51 (diff) | |
download | gdb-871a6bd2d852b0fb677386e1be78c3f4c6939b48.zip gdb-871a6bd2d852b0fb677386e1be78c3f4c6939b48.tar.gz gdb-871a6bd2d852b0fb677386e1be78c3f4c6939b48.tar.bz2 |
Make frag fr_fix unsigned
The field only stores unsigned values, so let's make it unsigned to
stop people worrying about the possibility of negative values.
* frags.h (struct frag <fr_fix>): Use unsigned type.
* frags.c (frag_new): Assert that current size exceeds
old_frags_var_max_size.
* ehopt.c (get_cie_info): Adjust for unsigned fr_fix.
* listing.c (calc_hex): Likewise.
* write.c (cvt_frag_to_fill, write_relocs): Likewise.
* config/tc-arc.c (md_convert_frag): Likewise.
* config/tc-avr.c (avr_patch_gccisr_frag): Likewise.
* config/tc-mips.c (md_convert_frag): Likewise.
* config/tc-rl78.c (md_convert_frag): Likewise.
* config/tc-rx.c (md_convert_frag): Likewise.
* config/tc-sparc.c (md_apply_fix): Likewise.
* config/tc-xtensa.c (next_instrs_are_b_retw): Likewise.
(unrelaxed_frag_min_insn_count, unrelaxed_frag_has_b_j): Likewise.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-arc.c | 2 | ||||
-rw-r--r-- | gas/config/tc-avr.c | 4 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 4 | ||||
-rw-r--r-- | gas/config/tc-rl78.c | 3 | ||||
-rw-r--r-- | gas/config/tc-rx.c | 3 | ||||
-rw-r--r-- | gas/config/tc-sparc.c | 2 | ||||
-rw-r--r-- | gas/config/tc-xtensa.c | 6 |
7 files changed, 11 insertions, 13 deletions
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index a4f617a..6cc4726 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -3271,7 +3271,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, int size, fix; struct arc_relax_type *relax_arg = &fragP->tc_frag_data; - fix = (fragP->fr_fix < 0 ? 0 : fragP->fr_fix); + fix = fragP->fr_fix; dest = fragP->fr_literal + fix; table_entry = TC_GENERIC_RELAX_TABLE + fragP->fr_subtype; diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index 7886022..df0833c 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -2635,8 +2635,8 @@ avr_patch_gccisr_frag (fragS *fr, int reg) /* Turn frag into ordinary code frag of now known size. */ fr->fr_var = 0; - fr->fr_fix = (offsetT) (where - fr->fr_literal); - gas_assert (fr->fr_fix <= fr->fr_offset); + fr->fr_fix = where - fr->fr_literal; + gas_assert (fr->fr_fix <= (valueT) fr->fr_offset); fr->fr_offset = 0; fr->fr_type = rs_fill; fr->fr_subtype = 0; diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 7eab392..70c6548 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -19056,7 +19056,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) relax_substateT subtype = fragp->fr_subtype; bfd_boolean second_longer = (subtype & RELAX_SECOND_LONGER) != 0; bfd_boolean use_second = (subtype & RELAX_USE_SECOND) != 0; - int first, second; + unsigned int first, second; fixS *fixp; first = RELAX_FIRST (subtype); @@ -19099,7 +19099,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec, fragS *fragp) sequence instead. */ while (fixp && fixp->fx_frag == fragp - && fixp->fx_where < fragp->fr_fix - second) + && (valueT) fixp->fx_where + second < fragp->fr_fix) { if (subtype & RELAX_USE_SECOND) fixp->fx_done = 1; diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 6d28eae..878c03f 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -1233,8 +1233,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, fragP->fr_next); if (fragP->fr_next != NULL - && ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address) - != fragP->fr_fix)) + && fragP->fr_next->fr_address - fragP->fr_address != fragP->fr_fix) as_bad (_("bad frag at %p : fix %ld addr %ld %ld \n"), fragP, (long) fragP->fr_fix, (long) fragP->fr_address, (long) fragP->fr_next->fr_address); diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 0a44fc4..8688837 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -2179,8 +2179,7 @@ md_convert_frag (bfd * abfd ATTRIBUTE_UNUSED, fragP->fr_var = 0; if (fragP->fr_next != NULL - && ((offsetT) (fragP->fr_next->fr_address - fragP->fr_address) - != fragP->fr_fix)) + && fragP->fr_next->fr_address - fragP->fr_address != fragP->fr_fix) as_bad (_("bad frag at %p : fix %ld addr %ld %ld \n"), fragP, (long) fragP->fr_fix, (long) fragP->fr_address, (long) fragP->fr_next->fr_address); diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 347db08..677a13f 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -3566,7 +3566,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT segment ATTRIBUTE_UNUSED) can be completely resolved here, i.e. if no undefined symbol is associated with it. */ if (sparc_relax && fixP->fx_addsy == NULL - && fixP->fx_where + 8 <= fixP->fx_frag->fr_fix) + && (valueT) fixP->fx_where + 8 <= fixP->fx_frag->fr_fix) { #define G0 0 #define O7 15 diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 458cba9..9350beb 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -8295,7 +8295,7 @@ next_instrs_are_b_retw (fragS *fragP) static xtensa_insnbuf insnbuf = NULL; static xtensa_insnbuf slotbuf = NULL; xtensa_isa isa = xtensa_default_isa; - int offset = 0; + unsigned int offset = 0; int slot; bfd_boolean branch_seen = FALSE; @@ -8688,7 +8688,7 @@ unrelaxed_frag_min_insn_count (fragS *fragP) xtensa_isa isa = xtensa_default_isa; static xtensa_insnbuf insnbuf = NULL; int insn_count = 0; - int offset = 0; + unsigned int offset = 0; if (!fragP->tc_frag_data.is_insn) return insn_count; @@ -8741,7 +8741,7 @@ unrelaxed_frag_has_b_j (fragS *fragP) { static xtensa_insnbuf insnbuf = NULL; xtensa_isa isa = xtensa_default_isa; - int offset = 0; + unsigned int offset = 0; if (!fragP->tc_frag_data.is_insn) return FALSE; |