aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-10-26 18:38:26 +1030
committerAlan Modra <amodra@gmail.com>2019-10-26 20:19:28 +1030
commit6f69abb0498286297936a178ba81c7e445aa4437 (patch)
tree7a5d73d08dad01d2423566cffb48b48cda5971a1 /gas/dw2gencfi.c
parent[gdb] Fix more typos in comments (2) (diff)
downloadbinutils-gdb-6f69abb0498286297936a178ba81c7e445aa4437.tar.gz
binutils-gdb-6f69abb0498286297936a178ba81c7e445aa4437.tar.bz2
binutils-gdb-6f69abb0498286297936a178ba81c7e445aa4437.zip
Optimise away eh_frame advance_loc 0
These can be generated when multiple cfi directives are emitted for an instruction and the insn frag is closed off between directives, as happens when listings are enabled. No doubt the advance_loc of zero could be avoided by backtracking over frags in dw2gencfi.c before calling cfi_add_advance_loc, but that seems like more work than cleaning up afterwards as this patch does. Noticed when looking at the testcase in PR25125. PR 25125 * dw2gencfi.c (output_cfi_insn): Don't output DW_CFA_advance_loc+0. * ehopt.c (eh_frame_estimate_size_before_relax): Return -1 for an advance_loc of zero. (eh_frame_relax_frag): Translate fr_subtype of 7 to size -1. (eh_frame_convert_frag): Handle fr_subtype of 7. Abort on unexpected fr_subtype.
Diffstat (limited to 'gas/dw2gencfi.c')
-rw-r--r--gas/dw2gencfi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index 388123fd241..b01e4c4a9ed 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -1598,7 +1598,9 @@ output_cfi_insn (struct cfi_insn_data *insn)
addressT delta = S_GET_VALUE (to) - S_GET_VALUE (from);
addressT scaled = delta / DWARF2_LINE_MIN_INSN_LENGTH;
- if (scaled <= 0x3F)
+ if (scaled == 0)
+ ;
+ else if (scaled <= 0x3F)
out_one (DW_CFA_advance_loc + scaled);
else if (scaled <= 0xFF)
{