From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 64020385087B; Thu, 13 Oct 2022 10:18:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64020385087B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665656324; bh=0MIb+QxgxT2MPtillc3BIAieFZohU8jAg2dqBJMO+Ec=; h=From:To:Subject:Date:From; b=eJH4Yk8TfXslzGxHDYH8YTC7bo7p2e0J78C2FnT/j/waL9GzXpzNlIsf5ZPM5UdN3 1bGvRdFeGWePYlKG8pQMl/QRP2mpPgEt10imqNU8ziFuRXLkHDPMkrvwrgy3ATKKQd D685hfsDSHK7hQc9q/ZhDe3bZuJe4TLajipAaw1w= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32 X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 927b2f4caf46e5ca49684c9a52a9786425c60fa2 X-Git-Newrev: 5be49e265d617f91d78d2d87fa8166e5cf6f83a2 Message-Id: <20221013101844.64020385087B@sourceware.org> Date: Thu, 13 Oct 2022 10:18:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5be49e265d61= 7f91d78d2d87fa8166e5cf6f83a2 commit 5be49e265d617f91d78d2d87fa8166e5cf6f83a2 Author: Tom de Vries Date: Thu Oct 13 12:18:39 2022 +0200 [gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32 =20 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 ... =20 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 arch= itecture. =20 This is similar to what was fixed in commit a5ac8e7fa3b ("[gdb/testsuite] Fix 64-bit dwarf test-cases with -m32") for for insta= nce .debug_abbrev. =20 Fix this in the same way, by using _op_offset to emit the debug_line of= fset. =20 Tested on x86_64-linux with native and target board unix/-m32. Diff: --- 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" =20 if { ${debug-line-offset-label} !=3D "" } { - 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" } =20 with_override Dwarf::define Dwarf::_macro_unit_define {