[Bug testsuite/34110] New: Fix buildid.exp and make it compatible with modern GCC-16
mcermak at redhat dot com
sourceware-bugzilla@sourceware.org
Mon Apr 27 13:25:42 GMT 2026
https://sourceware.org/bugzilla/show_bug.cgi?id=34110
Bug ID: 34110
Summary: Fix buildid.exp and make it compatible with modern
GCC-16
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: testsuite
Assignee: systemtap at sourceware dot org
Reporter: mcermak at redhat dot com
Target Milestone: ---
The buildid.exp testcase is long term broken. Turns out there are two problems
in it. 1) log level: ERROR -> WARNING. This is handled by a regexp update.
the other problem is that 2) old GCC-11 had the following behavior:
# eu-readelf -n buildid2.ro | grep -B2 -A2 "Build ID"
eu-readelf: cannot get content of note: garbage data Owner Data size
Type
GNU 20 GNU_BUILD_ID
Build ID: 57eec9e035f81d85c685c88f31d10f31f6768b8c
# gcc buildid2.ro -o ./buildid.mojex
# eu-readelf -n buildid.mojex | grep -B2 -A2 "Build ID"
eu-readelf: Owner Data size Type
GNU 20 GNU_BUILD_ID
cannot get content of note: garbage data
Build ID: e83865004549f3f3e940976fd37a0ab18dccab89
GNU 20 GNU_BUILD_ID
Build ID: 57eec9e035f81d85c685c88f31d10f31f6768b8c
Note section [ 4] '.note.ABI-tag' of 32 bytes at offset 0x3a4:
# rpm -q gcc
gcc-11.5.0-14.el9.x86_64
#
That said, it takes the build id of the original file, generates a new one, and
stores both of them to the resulting binary. OTOH, modern GCC-16 behaves as
follows:
f45 x86_64 # eu-readelf -n buildid2.ro | grep -B2 -A2 "Build ID"
eu-readelf: cannot get content of note: garbage data
Owner Data size Type
GNU 20 GNU_BUILD_ID
Build ID: 57eec9e035f81d85c685c88f31d10f31f6768b8c
f45 x86_64 # gcc buildid2.ro -o ./buildid.mojex
f45 x86_64 # eu-readelf -n buildid.mojex | grep -B2 -A2 "Build ID"
Owner Data size Type
GNU 20 GNU_BUILD_ID
Build ID: 88b791c4f9c6b29f3417f91eaed5a0c00c5568bd
Note section [15] '.note.gnu.property' of 64 bytes at offset 0x11e0:
f45 x86_64 #
That said, it generates a new build id, and throws away the original one.
Having two different buildids in one binary file doesn't seem to make sense to
me. So, let's explicitly tell GCC not to generate new build-id. That way it
will re-use the build-id from the original file, and the testcase will pass
(again) even with modern GCC-16. Following patch does address both issues:
$ git diff
diff --git a/testsuite/systemtap.base/buildid.exp
b/testsuite/systemtap.base/buildid.exp
index 25f8a61d8..c602b6c5f 100644
--- a/testsuite/systemtap.base/buildid.exp
+++ b/testsuite/systemtap.base/buildid.exp
@@ -126,7 +126,7 @@ set ok 0
spawn staprun $bid_ko -c $bid_exepath
expect {
-timeout 180
- -re {ERROR: Build-id mismatch} { incr ok; exp_continue }
+ -re {(ERROR|WARNING): Build-id mismatch} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
@@ -137,14 +137,14 @@ if { [error_handler [expr $ok==1] "$test !ok - removed
($ok)"] } { return }
set bid_bid $srcdir/$subdir/buildid.hex
system "objcopy --remove-section=.note.gnu.build-id buildid.ro buildid1.ro"
system "objcopy --add-section .note.gnu.build-id=$bid_bid buildid1.ro
buildid2.ro"
-set res [target_compile "" $bid_exepath executable
"additional_flags=buildid2.ro"]
+set res [target_compile "" $bid_exepath executable
"additional_flags=buildid2.ro additional_flags=-Wl,--build-id=none"]
if { [error_handler [expr {$res==""}] "$test (build id modified)"] } { return
}
set ok 0
spawn staprun $bid_ko -c $bid_exepath
expect {
-timeout 180
- -re {ERROR: Build-id mismatch} { incr ok; exp_continue }
+ -re {(ERROR|WARNING): Build-id mismatch} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
@@ -250,7 +250,7 @@ set ok 0
spawn staprun $bid_shared_ko -c $bid_exepath
expect {
-timeout 180
- -re {ERROR: Build-id mismatch} { incr ok; exp_continue }
+ -re {(ERROR|WARNING): Build-id mismatch} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
@@ -273,7 +273,7 @@ set ok 0
spawn staprun $bid_shared_ko -c $bid_exepath
expect {
-timeout 180
- -re {ERROR: Build-id mismatch} { incr ok; exp_continue }
+ -re {(ERROR|WARNING): Build-id mismatch} { incr ok; exp_continue }
timeout { fail "$test (timeout)" }
eof { }
}
$
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Systemtap
mailing list