[gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32
authorTom de Vries <tdevries@suse.de>
Thu, 13 Oct 2022 10:18:39 +0000 (12:18 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 13 Oct 2022 10:18:39 +0000 (12:18 +0200)
commit5be49e265d617f91d78d2d87fa8166e5cf6f83a2
tree322cfd4e4bf1d9166f5fb1cd02c1b5b7a6fec3dd
parent927b2f4caf46e5ca49684c9a52a9786425c60fa2
[gdb/testsuite] Fix gdb.dwarf2/macro-source-path.exp with -m32

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.
gdb/testsuite/lib/dwarf.exp