Build gdb.base/gnu-ifunc.exp with lazy binding
authorLuis Machado <luis.machado@linaro.org>
Mon, 25 Jan 2021 12:46:49 +0000 (09:46 -0300)
committerLuis Machado <luis.machado@linaro.org>
Mon, 8 Feb 2021 21:56:48 +0000 (18:56 -0300)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/gnu-ifunc.exp

index 8aa739749f043cea6fcfe8cb0f47f325ecb4c4a0..ca011e4eb259f65d16032f4fb5a399a0dd2e5f16 100644 (file)
@@ -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.
index d6064d3c4ac237ffd73efb2a41b9250fbba6f5e9..4ec529130ce9acac5bbf9147aa106eb0ff742417 100644 (file)
@@ -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"
     }
This page took 0.036602 seconds and 4 git commands to generate.