From 823337810468cc5775d0ebd645399756c86453d3 Mon Sep 17 00:00:00 2001 From: Markus Metzger Date: Wed, 13 Jan 2021 16:41:43 +0100 Subject: [PATCH] gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp In gdb.btrace/rn-dl-bind.exp we test that we can reverse-step over recorded dynamic linking. The test covers specific behaviour to support _dl_runtime_resolve calling the resolved function by returning to it. This would normally mess up stepping as we'd end up with backtraces that contain the same functions but different frame ids. Since GDB needs to recognize a return from _dl_runtime_resolve, the test only passes when debug information for _dl_runtime_resolve is available. The test requires that symbols are bound lazily. Otherwise, we won't record dynamic linking and the test will be fairly pointless. Recent GCC pass -z now by default to bind symbols eagerly. Add -z lazy to the test's ldflags to enforce lazy binding. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.btrace/rn-dl-bind.exp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 970d6fef727..e861ec1129d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2021-03-03 Markus Metzger + + * gdb.btrace/rn-dl-bind.exp: Add ldflags=-Wl,-z,lazy. + 2021-03-03 Markus Metzger * gdb.btrace/non-stop.exp: Adjust expected source lines. diff --git a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp index 65e445334af..204e88093a4 100644 --- a/gdb/testsuite/gdb.btrace/rn-dl-bind.exp +++ b/gdb/testsuite/gdb.btrace/rn-dl-bind.exp @@ -27,7 +27,8 @@ if { [skip_btrace_tests] } { } standard_testfile -if [prepare_for_testing "failed to prepare" $testfile $srcfile {c++ debug}] { +if [prepare_for_testing "failed to prepare" $testfile $srcfile \ + {c++ debug ldflags=-Wl,-z,lazy}] { return -1 } -- 2.30.2