From: Bratislav Filipovic Date: Fri, 3 Apr 2026 06:11:02 +0000 (+0200) Subject: testsuite: ada-valprint-error relocation issue X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ae26f34ef5ac863203d63fffc968d63e823172f;p=thirdparty%2Fbinutils-gdb.git testsuite: ada-valprint-error relocation issue The ada-valprint-error.exp test links a nodebug .o file with a separate DWARF .o file generated by lib/dwarf.exp. This requires the linker to apply relocations for initialized pointers in the .data section. Some clang + linker combinations fail to apply these relocations, leaving fd__global as NULL instead of pointing to buffer. This causes the test to print null instead of the expected error message. Binary evidence from .comment section confirms which compiler and linker were used. Testing shows: - GCC 13 + GNU ld 2.42: PASS - clang 20 + GNU ld 2.42: FAIL - clang 22 + ld.lld 22: FAIL - clang 17/19 + GNU ld 2.45.0: PASS The failure is a linker limitation when handling this specific relocation pattern, not a GDB bug. Document this in the test file to help users understand why the test may fail with certain toolchains. Approved-By: Tom de Vries --- diff --git a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp index f3d61e91199..00e737bcef2 100644 --- a/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp +++ b/gdb/testsuite/gdb.dwarf2/ada-valprint-error.exp @@ -107,6 +107,27 @@ if { [prepare_for_testing ${testfile}.exp ${testfile} \ return -1 } +# Note: This test may fail with certain clang + linker combinations +# Specifically, clang + ld.lld can fail to apply relocations when linking +# nodebug .o with separate DWARF .o, leaving fd__global as NULL instead +# of pointing to buffer. The failure is a linker limitation, not a GDB bug. +# +# Known to fail: clang 20/22 + GNU ld 2.42, clang 22 + ld.lld 22 +# Known to pass: GCC + GNU ld, clang 17/19 + GNU ld 2.45.0 +set unsupported 0 +gdb_test_multiple "print /x fd__global" "check fd__global value" { + -re -wrap "@0x0: 0x0" { + set unsupported 1 + } + -re -wrap "" { + pass $gdb_test_name + } +} +if {$unsupported} { + unsupported "linker failed to apply relocation for fd__global" + return +} + gdb_test_no_output "set language ada" gdb_test "print fd.global" \