[gdb/testsuite] Fix 64-bit dwarf test-cases with -m32
authorTom de Vries <tdevries@suse.de>
Fri, 19 Nov 2021 14:09:05 +0000 (15:09 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 19 Nov 2021 14:09:05 +0000 (15:09 +0100)
commita5ac8e7fa3b9c418b6d14ae9d6b0e2e128733ce7
tree7f8dfa58bcbe392198356bde1f02a104d83ace91
parent2e5843d87c4050bf1109921481fb29e1c470827f
[gdb/testsuite] Fix 64-bit dwarf test-cases with -m32

When running test-case gdb.dwarf2/loc-sec-offset.exp with target board -m32,
I run into:
...
builtin_spawn -ignore SIGHUP gcc -fno-stack-protector -m32 \
  -fdiagnostics-color=never -c -o loc-sec-offset-dw641.o \
  loc-sec-offset-dw64.S^M
as: loc-sec-offset-dw641.o: unsupported relocation type: 0x1^M
loc-sec-offset-dw64.S: Assembler messages:^M
loc-sec-offset-dw64.S:29: Error: cannot represent relocation type \
  BFD_RELOC_64^M
...

Looking at line 29, we have:
...
        .8byte        .Labbrev1_begin   /* Abbrevs */
...

It would be nice if the assembler could handle this somehow.  But I guess
it's not unreasonable that an assembler for a 32-bit architecture will object
to handling 64-bit labels.

Instead, work around this in the dwarf assembler by emitting:
...
        .4byte        .Labbrev1_begin   /* Abbrevs (lsw) */
        .4byte        0                 /* Abbrevs (msw) */
...

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

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28383
gdb/testsuite/lib/dwarf.exp
gdb/testsuite/lib/gdb.exp