From: Christian Weisgerber Subject: Declare _hwcap as hidden To: tech@openbsd.org Date: Sat, 9 May 2026 14:40:36 +0200 I think this was forgotten when elf_aux_info() was added. The _hwcap variables are only used inside libc, so they should be declared hidden. We can just add the declarations to hidden/sys/auxv.h. Before: $ readelf -s obj/libc.so.103.0| fgrep _hwcap 4063: 00000000001051c8 4 OBJECT LOCAL DEFAULT 23 _hwcap_avail 4064: 00000000001051c0 8 OBJECT LOCAL DEFAULT 23 _hwcap 4065: 00000000001051d8 4 OBJECT LOCAL DEFAULT 23 _hwcap2_avail 4066: 00000000001051d0 8 OBJECT LOCAL DEFAULT 23 _hwcap2 After: $ readelf -s obj/libc.so.103.0| fgrep _hwcap 1784: 0000000000100880 8 OBJECT LOCAL HIDDEN 23 _hwcap 1785: 0000000000100888 4 OBJECT LOCAL HIDDEN 23 _hwcap_avail 1786: 0000000000100890 8 OBJECT LOCAL HIDDEN 23 _hwcap2 1787: 0000000000100898 4 OBJECT LOCAL HIDDEN 23 _hwcap2_avail OK? ----------------------------------------------- commit e030561035c15c903f1e6b0a1feacb5492867a7b (hwcap) from: Christian Weisgerber date: Sat May 9 12:38:40 2026 UTC declare _hwcap and related variables as hidden diff dfc436a2a7e14a48b9213e241b55d30d94477a54 e030561035c15c903f1e6b0a1feacb5492867a7b commit - dfc436a2a7e14a48b9213e241b55d30d94477a54 commit + e030561035c15c903f1e6b0a1feacb5492867a7b blob - dd2cd9f40451841c3fe7b8ae2dd9274b1551c959 blob + e57f9dcb277fd79922c7c82744bb5e326da436cf --- lib/libc/dlfcn/init.c +++ lib/libc/dlfcn/init.c @@ -21,6 +21,7 @@ #include #include #include /* timekeep */ +#include /* _hwcap */ #ifndef PIC #include blob - a4b7667ba6fd0d1c9056e2e645d2a637e8a51790 blob + c9852bc4ca467710893631f61e11098c5ecc2b44 --- lib/libc/gen/elf_aux_info.c +++ lib/libc/gen/elf_aux_info.c @@ -20,11 +20,8 @@ #include #include +#include -extern int _pagesize; -extern unsigned long _hwcap, _hwcap2; -extern int _hwcap_avail, _hwcap2_avail; - int elf_aux_info(int request, void *buf, int buflen) { blob - cd566b7b2a21edc0421c3ef7063a8fca20fa635b blob + 07eec4dcd49a65521acc6daefd1a127a833378b6 --- lib/libc/hidden/sys/auxv.h +++ lib/libc/hidden/sys/auxv.h @@ -21,6 +21,11 @@ #include_next +__BEGIN_HIDDEN_DECLS +extern unsigned long _hwcap, _hwcap2; +extern int _hwcap_avail, _hwcap2_avail; +__END_HIDDEN_DECLS + PROTO_DEPRECATED(elf_aux_info); #endif /* !_LIBC_SYS_AUXV_H_ */ -- Christian "naddy" Weisgerber naddy@mips.inka.de