musl/ldso
Alex Xu (Hello71) 63c67053a3 in early stage ldso before __dls2b, call mprotect with __syscall
if LTO is enabled, gcc hoists the call to ___errno_location outside the
loop even though the access to errno is gated behind head != &ldso
because ___errno_location is marked __attribute__((const)). this causes
the program to crash because TLS is not yet initialized when called from
__dls2. this is also possible if LTO is not enabled; even though gcc 11
doesn't do it, it is still wrong to use errno here.

since the start and end are already aligned, we can simply call
__syscall instead of using global errno.

Fixes: e13a2b8953 ("implement PT_GNU_RELRO support")
2022-07-02 16:12:04 -04:00
..
dlstart.c define and use internal macros for hidden visibility, weak refs 2018-09-05 14:05:14 -04:00
dynlink.c in early stage ldso before __dls2b, call mprotect with __syscall 2022-07-02 16:12:04 -04:00