opnsense-src/libexec
Jessica Clarke 729d2b16b7 rtld-elf: Support IFUNCs on riscv
GNU/Linux has historically had the following two resolver prototypes:

  1. Elf_Addr(uint64_t, void *)
  2. Elf_Addr(uint64_t, void *, void *)

For the former, AT_HWCAP is passed in the first argument, and NULL in
the second. For the latter, AT_HWCAP is still passed, and the second
argument is a pointer to their home-grown __riscv_hwprobe function.
Should they want to use the third argument in future, they'll have to
introduce yet another prototype to allow for later expansion, and then
all users will have to check whether the second argument is NULL to know
if the third argument really exists. This is all rather silly and will
surely prove fun in the face of type-checking CFI.

Instead, be like arm64 and just define all 8 possible general purpose
register arguments up front. To naive source code that forgets non-Linux
OSes exist this will be compatible with prototype 1 above, since the
second argument will be 0 and it won't look further (though should we
start using the second argument for something that wouldn't be true any
more and it might think it's __riscv_hwprobe, but that incompatibility
is one we can defer committing to, and can choose to never adopt).

Until the standard interface for querying extension information[1] is
settled and implemented in FreeBSD there's not much you can do in a
resolver other than use HWCAP_ISA_B, but this gets the infrastructure in
place for when that day comes.

[1] https://github.com/riscv-non-isa/riscv-c-api-doc/pull/74

Reviewed by:	kib, mhorne
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D46278
2024-08-22 20:36:44 +01:00
..
atf Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
atrun Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
blacklistd-helper Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
bootpd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
comsat Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
dma Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
fingerd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
flua Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ftpd Remove "All Rights Reserved" from FreeBSD Foundation copyrights 2024-07-30 12:16:36 -04:00
getty Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
hyperv Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
kgdb crashinfo: Print stack traces for all on-CPU threads 2024-01-15 16:36:40 -05:00
mail.local Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
makewhatis.local Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
mknetid Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
nuageinit nuageinit: improve debugging when mkdir fails 2024-08-20 12:09:43 +02:00
phttpget Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
pppoed Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rbootd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rc safe_dot check file is a file 2024-08-16 13:15:20 -07:00
revnetgroup Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rpc.rquotad Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rpc.rstatd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rpc.rusersd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rpc.rwalld Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rpc.sprayd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
rtld-elf rtld-elf: Support IFUNCs on riscv 2024-08-22 20:36:44 +01:00
rtld-elf32 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
save-entropy Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
smrsh Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
talkd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
tcpd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
tests Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
tftp-proxy Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
tftpd Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ulog-helper Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ypxfr Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile nuageinit: add basic support for cloudinit. 2024-03-15 09:22:16 +01:00
Makefile.inc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00