[binutils-gdb] binutils test_build_id_debuglink

Alan Modra amodra@sourceware.org
Sun May 24 11:21:41 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2766bde902e36f4203f456b0794f6b9592c6be12

commit 2766bde902e36f4203f456b0794f6b9592c6be12
Author: Alan Modra <amodra@gmail.com>
Date:   Sun May 24 14:23:03 2026 +0930

    binutils test_build_id_debuglink
    
    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.

Diff:
---
 binutils/testsuite/binutils-all/objdump.exp | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

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


More information about the Binutils-cvs mailing list