[compiler-rt] [CompilerRT][SanitizerCommon]Implement getauxval in FreeBSD (PR #186961)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 07:04:46 PDT 2026


================
@@ -54,6 +54,19 @@ static inline decltype(AuxInfo::a_v) getauxval(decltype(AuxInfo::a_type) type) {
   return 0;
 }
 
+#elif SANITIZER_FREEBSD
+
+#  define SANITIZER_USE_GETAUXVAL 1
+#  include <sys/auxv.h>
+static inline size_t getauxval(decltype(Elf_Auxinfo::a_type) type) {
+  for (const Elf_Auxinfo* aux = (const Elf_Auxinfo*)libsys_elf_aux_vec_addr();
----------------
aokblast wrote:

> Where does this function come from? It isn't there [in the header](https://github.com/freebsd/freebsd-src/blob/bea1c2fcd7839fd90a8ce96d6dc6a033779bc3c2/sys/sys/auxv.h#L36).

Sorry I forget to attach the parent patch on phab. https://reviews.freebsd.org/D55891
This might be unnecessary as we can just reference the pointer. But I think it would be safer.


https://github.com/llvm/llvm-project/pull/186961


More information about the llvm-commits mailing list