public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32
Date: Thu, 13 Oct 2022 12:19:03 +0200	[thread overview]
Message-ID: <20221013101900.GA25490@delia.home> (raw)

Hi,

With test-case gdb.dwarf2/macro-source-path.exp and target board unix/-m32, I
run into:
...
as: macro-source-path-gcc11-ld238-dw5-filename-641.o: \
  unsupported relocation type: 0x1^M
...

The problem is that we have 64-bit dwarf so the debug_line offset in the
.debug_macro section is an 8-byte entity, emitted using ".8byte":
...
        .section .debug_macro
.Lcu_macros4:
        .2byte        5                 /* version */
        .byte        3                  /* flags */
        .8byte        .LLlines3         /* debug_line offset */
...
but the linker doesn't support 8-byte relocation types on a 32-bit architecture.

This is similar to what was fixed in commit a5ac8e7fa3b
("[gdb/testsuite] Fix 64-bit dwarf test-cases with -m32") for for instance
.debug_abbrev.

Fix this in the same way, by using _op_offset to emit the debug_line offset.

Tested on x86_64-linux with native and target board unix/-m32.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32

---
 gdb/testsuite/lib/dwarf.exp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index b85ec290299..586c98ececc 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -2224,11 +2224,8 @@ namespace eval Dwarf {
 	_op .byte $flags "flags"
 
 	if { ${debug-line-offset-label} != "" } {
-	    if { ${is-64} } {
-		_op .8byte ${debug-line-offset-label} "debug_line offset"
-	    } else {
-		_op .4byte ${debug-line-offset-label} "debug_line offset"
-	    }
+	    _op_offset [expr ${is-64} ? 8 : 4] ${debug-line-offset-label} \
+		"debug_line offset"
 	}
 
 	with_override Dwarf::define Dwarf::_macro_unit_define {

                 reply	other threads:[~2022-10-13 10:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221013101900.GA25490@delia.home \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).