binutils test_build_id_debuglink

Message ID ahLeYCYkXMCS4Iqy@squeak.grove.modra.org
State New
Headers
Series binutils test_build_id_debuglink |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Alan Modra May 24, 2026, 11:17 a.m. UTC
  I saw build-id-debuglink test failures on a number of targets due to
deleting the glibc source I'd used when building the cross toolchains.
The tests failed with timeouts.

$ objdump -Sl tmpdir/testprog.strip

tmpdir/testprog.strip:     file format elf64-ia64-little

Disassembly of section .init:

40000000000003b0 <_init>:
_init():
/home/alan/src/glibc-2.38/csu/../sysdeps/ia64/crti.S:137
^C

I don't know where debuginfod was looking to try to find that crti.S
source, but wherever it was took too long, and we aren't trying to
test debuginfod here.  So remove the extraneous source dependencies
by building with -shared -nostdlib.  When making this change I also
removed the code passing extra options to target_compile via
CFLAGS_FOR_TARGET.  Instead, pass extra options with additional_flags.

	* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
	Don't use CFLAGS_FOR_TARGET to pass extra options to
	target_compile.  Instead use additional_flags.  Build test
	with -fPIC -shared -nostdlib.
  

Patch

diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index 1bb8f55d109..734f93298ed 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -622,28 +622,21 @@  proc test_build_id_debuglink {option} {
     global STRIP
     global OBJCOPY
     global OBJDUMP
-    global CFLAGS_FOR_TARGET
     global exe
     
     set test "build-id-debuglink ($option)"
 
     # Use a fixed build-id.
-    if { [info exists CFLAGS_FOR_TARGET] } {
-	set save_CFLAGS_FOR_TARGET $CFLAGS_FOR_TARGET
+    set xflags debug
+    foreach i "-Wl,--build-id=0x12345678abcdef01,--compress-debug-sections=$option -fPIC -shared -nostdlib" {
+	append xflags " additional_flags=$i"
     }
-    set CFLAGS_FOR_TARGET "-g -Wl,--build-id=0x12345678abcdef01,--compress-debug-sections=$option"
 
-    if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog${exe} executable debug] != "" } {
+    if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog${exe} executable $xflags] != "" } {
 	unsupported "$test (build)"
 	return
     }
 
-    if { [info exists save_CFLAGS_FOR_TARGET] } {
-	set CFLAGS_FOR_TARGET $save_CFLAGS_FOR_TARGET
-    } else {
-	unset CFLAGS_FOR_TARGET
-    }
-
     if { [binutils_run $STRIP "--strip-debug --remove-section=.comment tmpdir/testprog${exe} -o tmpdir/testprog.strip"] != "" } {
 	fail "$test (strip debug info)"
 	return