[PATCH v2] s390: Do not use canonical PLT if pointer equality is not needed
Jens Remus
jremus@linux.ibm.com
Tue Mar 17 16:28:31 GMT 2026
On 3/17/2026 12:22 PM, Alan Modra wrote:
> 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
Great suggestion! I'll send a v3.
I'll see whether I can use Fangrui Song's cross-build/test script [1]
as base to run some tests for other targets myself.
[1]: https://inbox.sourceware.org/binutils/CAN30aBFaYE4CLUcxGk61Qc4+2K7yDPEDyhbKb7QBEJ-T4ENrxg@mail.gmail.com/
> 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
Andreas and I am aware that I fixed the issue for s390 64-bit (s390x)
only.
s390 32-bit (s390) is quite obsolete as, Linux Kernel 6.19 (February
2026) removed 32-bit compat support on s390 [2] and is thus s390 64-bit
(s390x) only and Glibc 2.43 (January 2026) deprecated s390 32-bit with
the intent to remove it in Glibc 4.44 [3].
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8e0b986c59c6
[3]: https://inbox.sourceware.org/libc-alpha/52c31093-9750-42ab-a830-134b3ffa2d4c@linux.ibm.com/T/#u
> 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.
Thanks! I have added those to the clear-xfail list.
> m68k-linux, riscv64-linux, s390-linux, sh4-linux, sparc64-linux and
> tilepro-linux will fail.
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
More information about the Binutils
mailing list