Page MenuHomeFreeBSD

rtld-elf: Pass HWCAP flags to ifunc resolver functions
AcceptedPublic

Authored by sarah.walker2_arm.com on Tue, Jan 6, 3:41 PM.
Tags
None
Referenced Files
F141922984: D54559.diff
Mon, Jan 12, 2:13 PM
F141922977: D54559.diff
Mon, Jan 12, 2:12 PM
F141911544: D54559.id169313.diff
Mon, Jan 12, 10:11 AM
Unknown Object (File)
Sun, Jan 11, 5:04 AM
Unknown Object (File)
Sat, Jan 10, 4:44 PM
Unknown Object (File)
Sat, Jan 10, 3:56 PM
Unknown Object (File)
Sat, Jan 10, 5:38 AM
Unknown Object (File)
Fri, Jan 9, 6:48 PM

Details

Reviewers
andrew
kib
Group Reviewers
arm64
Summary

Function arguments are based on Section 9.4.1 "GNU C Library IFUNC interface"
from "System V ABI for the Arm 64-bit Architecture (AArch64)", 2025Q1.
(https://github.com/ARM-software/abi-aa/releases/download/2025Q1/sysvabi64.pdf)

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 69763
Build 66646: arc lint + arc unit

Event Timeline

There should be a followup change to sys/arm64/include/ifunc.h to update DEFINE_UIFUNC. We can also use this to simplify the ifunc handlers in sys/crypto/sha2/sha512c.c and sys/crypto/sha2/sha256c.c

Will you also be implementing this for csu for static binaries (often forgotten, including by me in the past)?

libexec/rtld-elf/aarch64/reloc.c
448

Why isn't this in a header?

454

Can this be NULL?

libexec/rtld-elf/aarch64/rtld_machdep.h
78

Shouldn't this live in a header somewhere? The SysV document also says glibc provides an __ifunc_arg_t typedef if you want to be fully compatible.

79–83

They're only uint64_t as placeholders for passing a 0 in a register.

There should be a followup change to sys/arm64/include/ifunc.h to update DEFINE_UIFUNC. We can also use this to simplify the ifunc handlers in sys/crypto/sha2/sha512c.c and sys/crypto/sha2/sha256c.c

Can you give more detail on what you want here please?

There should be a followup change to sys/arm64/include/ifunc.h to update DEFINE_UIFUNC. We can also use this to simplify the ifunc handlers in sys/crypto/sha2/sha512c.c and sys/crypto/sha2/sha256c.c

Can you give more detail on what you want here please?

ifunc.h has the DEFINE_UIFUNC macro where the first two arguments in the generated function signature will need an update. The other two files use DEFINE_UIFUNC and call elf_aux_info to read the HWCAPs, but could be updated after this change (and a similar change for static binaries)

There should be a followup change to sys/arm64/include/ifunc.h to update DEFINE_UIFUNC. We can also use this to simplify the ifunc handlers in sys/crypto/sha2/sha512c.c and sys/crypto/sha2/sha256c.c

Can you give more detail on what you want here please?

ifunc.h has the DEFINE_UIFUNC macro where the first two arguments in the generated function signature will need an update. The other two files use DEFINE_UIFUNC and call elf_aux_info to read the HWCAPs, but could be updated after this change (and a similar change for static binaries)

Addressed in https://reviews.freebsd.org/D54598 and https://reviews.freebsd.org/D54600

libexec/rtld-elf/aarch64/reloc.c
448
libexec/rtld-elf/aarch64/rtld_machdep.h
78
libexec/rtld-elf/aarch64/reloc.c
454–461

Can this be done statically?

455

Will you also be implementing this for csu for static binaries (often forgotten, including by me in the past)?

See https://reviews.freebsd.org/D54599

libexec/rtld-elf/aarch64/rtld_machdep.h
80–83

Both these lines now exceed 80 chars (I suggest using tools/build/checkstyle9.pl prior to submitting patches)

libexec/rtld-elf/aarch64/reloc.c
454–461

Exceeds 80 chars

455

This, and the hwcap3/4 lines, are indented using spaces not tabs

libexec/rtld-elf/aarch64/reloc.c
455

Continuation lines should use indent +4 spaces.

libexec/rtld-elf/aarch64/rtld_machdep.h
83

No need to additionally indent, it is constant +4 spaces relatively to the start of the split line.

This revision is now accepted and ready to land.Sat, Jan 10, 3:42 AM
libexec/rtld-elf/aarch64/reloc.c
447

As a pure cosmetic, I do not think that we need to put __ifunc_arg into the private namespace. This is rtld, which is freestanding program, and which symbols are exported in controlled way. So there would be no harm from removing the '__' prefix.

Move ifunc_arg from private namespace and fix const-ness.

This revision now requires review to proceed.Mon, Jan 12, 9:42 AM
This revision is now accepted and ready to land.Mon, Jan 12, 10:42 AM