[PATCH v2] s390: Do not use canonical PLT if pointer equality is not needed
Alan Modra
amodra@gmail.com
Tue Mar 17 11:22:35 GMT 2026
On Mon, Mar 16, 2026 at 06:07:47PM +0100, Jens Remus wrote:
> +# PR 29655 (cont.): Check that in PIC code linked as PDE taking the address
> +# of a function defined in a DSO results in the function address (from GOT)
> +# and not the "canonical PLT" address from the PDE.
> +# This is just an optimization and both is valid, although libraries may
> +# depend on this specific behavior, so do not complain loudly.
> +setup_xfail *-*-*
> +clear_xfail i?86-*-* powerpc*-*-* s390x-*-* x86_64-*-*
> +run_ld_link_exec_tests [list \
> + [list \
> + "Run pr29655" \
> + "$NOPIE_LDFLAGS -Wl,--no-as-needed,-rpath,tmpdir tmpdir/pr29655.so" \
> + "" \
> + { pr29655b.c } \
> + "pr29655" \
> + "pass.out" \
> + "-fPIC" \
> + ] \
> +]
A test that needs to be run is inferior to a test that compiles and
examines an object, because the former only works natively. I think
you can likely turn this into a run_cc_link_tests that checks the
executable with readelf --dyn-sym looking for a zero value undefined
fun_public.
eg. this (s390x)
6: 0000000000000000 0 FUNC GLOBAL DEFAULT UND fun_public
Not this (s390), which is defining the sym on a plt stub (via ld.so
magic) and would therefore fail when run.
8: 00400424 0 FUNC GLOBAL DEFAULT UND fun_public
For the cross-toolchain targets that I test, it looks like
aarch64-linux, alpha-linux, arm-linux, hppa-linux, ia64-linux,
microblaze-linux, mips-linux, mips64-linux-gnuabi64,
powerpc64le-linux, powerpc64-linux, powerpc-linux, s390x-linux and
x86_64-pc-linux will pass.
m68k-linux, riscv64-linux, s390-linux, sh4-linux, sparc64-linux and
tilepro-linux will fail.
--
Alan Modra
More information about the Binutils
mailing list