mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-23 22:52:23 +03:00
bc9b6ea0df
since commits2907afb8db
and6fc30c2493
, __dls2 is no longer called via symbol lookup, but instead uses relative addressing that needs to be resolved at link time. on some linker versions, and/or if -Bsymbolic-functions is not used, the linker may leave behind a dynamic relocation, which is not suitable for bootstrapping the dynamic linker, if the reference to __dls2 is marked hidden but the definition is not actually hidden. correcting the definition to use hidden visibility fixes the problem. the static-PIE entry point rcrt1 was likewise affected and is also fixed by this patch.
17 lines
443 B
C
17 lines
443 B
C
#define SHARED
|
|
#define START "_start"
|
|
#define _dlstart_c _start_c
|
|
#include "../src/ldso/dlstart.c"
|
|
|
|
int main();
|
|
void _init() __attribute__((weak));
|
|
void _fini() __attribute__((weak));
|
|
_Noreturn int __libc_start_main(int (*)(), int, char **,
|
|
void (*)(), void(*)(), void(*)());
|
|
|
|
__attribute__((__visibility__("hidden")))
|
|
_Noreturn void __dls2(unsigned char *base, size_t *sp)
|
|
{
|
|
__libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
|
|
}
|