public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] PR29494 Trailing jump table on ARM
@ 2022-08-28 11:38 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-08-28 11:38 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6f6f5b0adc9efd103c434fd316e8c880a259775d

commit 6f6f5b0adc9efd103c434fd316e8c880a259775d
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 23 16:18:25 2022 +0930

    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:
---
 gas/dwarf2dbg.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-28 11:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-28 11:38 [binutils-gdb] PR29494 Trailing jump table on ARM Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).