From: Alan Modra Date: Tue, 23 Aug 2022 06:48:25 +0000 (+0930) Subject: PR29494 Trailing jump table on ARM X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f6f5b0adc9efd103c434fd316e8c880a259775d;p=binutils-gdb.git PR29494 Trailing jump table on ARM out_inc_line_addr and relax_inc_line_addr are passed INT_MAX as line_delta to flag end of section. This filters its way down to size_inc_line_addr and emit_inc_line_addr. Pass line_delta on to scale_addr_delta where it can be used to omit an unaligned opcode error. PR 29494 * dwarf2dbg.c (scale_addr_delta): Delete unnecessary forward decl. Add line_delta param. Don't print error at end of section, just round the address down. (size_inc_line_addr, emit_inc_line_addr): Adjust calls. --- diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 8f3d528ed2e..dbcf9cf7226 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1572,15 +1572,15 @@ out_set_addr (symbolS *sym) emit_expr (&exp, sizeof_address); } -static void scale_addr_delta (addressT *); - static void -scale_addr_delta (addressT *addr_delta) +scale_addr_delta (int line_delta, addressT *addr_delta) { static int printed_this = 0; if (DWARF2_LINE_MIN_INSN_LENGTH > 1) { - if (*addr_delta % DWARF2_LINE_MIN_INSN_LENGTH != 0 && !printed_this) + /* Don't error on non-instruction bytes at end of section. */ + if (line_delta != INT_MAX + && *addr_delta % DWARF2_LINE_MIN_INSN_LENGTH != 0 && !printed_this) { as_bad("unaligned opcodes detected in executable segment"); printed_this = 1; @@ -1603,7 +1603,7 @@ size_inc_line_addr (int line_delta, addressT addr_delta) int len = 0; /* Scale the address delta by the minimum instruction length. */ - scale_addr_delta (&addr_delta); + scale_addr_delta (line_delta, &addr_delta); /* INT_MAX is a signal that this is actually a DW_LNE_end_sequence. We cannot use special opcodes here, since we want the end_sequence @@ -1667,7 +1667,7 @@ emit_inc_line_addr (int line_delta, addressT addr_delta, char *p, int len) gas_assert ((offsetT) addr_delta >= 0); /* Scale the address delta by the minimum instruction length. */ - scale_addr_delta (&addr_delta); + scale_addr_delta (line_delta, &addr_delta); /* INT_MAX is a signal that this is actually a DW_LNE_end_sequence. We cannot use special opcodes here, since we want the end_sequence