aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@linaro.org>2021-01-25 09:46:49 -0300
committerLuis Machado <luis.machado@linaro.org>2021-02-08 18:56:48 -0300
commit3d4aae4860c41aeaab7a8d3daefe0fb50b40f4c6 (patch)
tree1e1c2417f04a4b5a553e8fc672fac06c04023aec
parent80b652efa2e969d865d06e1a4aec16b4dcd9f435 (diff)
downloadbinutils-3d4aae4860c41aeaab7a8d3daefe0fb50b40f4c6.zip
binutils-3d4aae4860c41aeaab7a8d3daefe0fb50b40f4c6.tar.gz
binutils-3d4aae4860c41aeaab7a8d3daefe0fb50b40f4c6.tar.bz2
Build gdb.base/gnu-ifunc.exp with lazy binding
The test expects the ifunc resolver to run lazily, at a later stage. Depending on the distro and toolchain configuration, this is not the case. Some configurations use non-lazy binding and thus the ifunc resolver resolves all the ifunc references very early in the process startup, before main. Ubuntu is one such case. It has switched its toolchains to pass -Wl,z,now by default, since 16.04. This wasn't a problem before 20.04 (at least for aarch64) because the toolchains did not support ifunc's. Forcing lazy binding makes the test run as expected, as opposed to the 80 or so failures it showed before the change. Tested on aarch64-linux/x86_64-linux Ubuntu 20.04. gdb/testsuite: 2021-02-08 Luis Machado <luis.machado@linaro.org> * gdb.base/gnu-ifunc.exp (build): Pass -Wl,z,lazy.
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/gnu-ifunc.exp4
2 files changed, 8 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8aa7397..ca011e4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-02-08 Luis Machado <luis.machado@linaro.org>
+
+ * gdb.base/gnu-ifunc.exp (build): Pass -Wl,z,lazy.
+
2021-02-08 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/enqueued-cu-base-addr.exp: Fix inter-CU reference.
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index d6064d3..4ec5291 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
@@ -64,6 +64,10 @@ proc build {resolver_attr resolver_debug final_debug} {
set lib_opts {}
set final_opts {}
+ # Force lazy binding so we don't resolve everything at process startup.
+ lappend exec_opts "additional_flags=-Wl,-z,lazy"
+ lappend lib_opts "additional_flags=-Wl,-z,lazy"
+
if {$resolver_attr} {
lappend lib_opts "additional_flags=-DIFUNC_RESOLVER_ATTR"
}