[PATCH] x86-64: Save and restore R10 in _dl_runtime_resolve [BZ #27279]
Florian Weimer
fweimer@redhat.com
Fri Dec 12 08:52:33 GMT 2025
* Jackson Stogel:
> As described in https://sourceware.org/bugzilla/show_bug.cgi?id=27279,
> Clang's `preserve_most` calling convention isn't compatible with lazy
> PLT resolution. Calls to functions marked with `preserve_most` are
> expected to leave r10 unaffected, but lazy PLT resolution
> clobbers r10 in `_dl_runtime_resolve` during a call to `_dl_fixup`.
>
> While not a bug, the r10 clobber can lead to surprising, difficult to
> debug behavior. This patch updates `_dl_runtime_resolve` to preserve
> r10, expanding compatibility with non-standard calling conventions.
>
> Tested: Ran make check on x86_64 linux and no new tests fail.
> If preferred, happy to add a test for this behavior as well.
>
> Signed-off-by: Jackson Stogel <jtstogel@gmail.com>
I tried to document it in the psABI:
<https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/45>
One concern that was raised is that Clang documents this functionality
as experimental. Maybe this can be fixed?
This functionality probably needs markup similar to
STO_AARCH64_VARIANT_PCS and STO_RISCV_VARIANT_CC for good developer
experience.
Thanks,
Florian
More information about the Libc-alpha
mailing list