make vdso work again

This commit is contained in:
Mikhail Filimonov 2021-08-09 20:52:26 +02:00
parent 918a69e70b
commit 2c01e2789a
No known key found for this signature in database
GPG Key ID: 6E49C2E9AF1220BE

View File

@ -17,7 +17,11 @@ static size_t __find_auxv(unsigned long type)
return (size_t) -1;
}
__attribute__((constructor)) static void __auxv_init()
/// __auxv_init should happen BEFORE the first use of getauxval.
/// but getauxval can be used in other init sections (namely in musl/clock_gettime.c::cgt_init),
/// so constructor(0) is needed to prioritize that constructor
/// see also: https://stackoverflow.com/questions/11106875/attribute-constructor-call-order-confusion/11198936
__attribute__((constructor(0))) static void __auxv_init()
{
size_t i;
for (i = 0; __environ[i]; i++);