mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-06 23:02:10 +03:00
remove unnecessary and problematic _Noreturn from crt/ldso startup
after commita48ccc159a
removed the use of _Noreturn on the stage3_func type (which only worked due to it being defined to the "GNU C" attribute in C99 mode), GCC could no longer assume that the ends of __dls2 and __dls2b are unreachable, and produced a warning that a function marked _Noreturn returns. also, since commit4390383b32
, the _Noreturn declaration for __libc_start_main in crt1/rcrt1 has been not only inconsistent with the definition, but wrong. formally, __libc_start_main does return, via a (hopefully) tail call to a helper function after the barrier. incorrect usage of _Noreturn in the declaration was probably formal UB. the _Noreturn specifiers were not useful in any of these places, so remove them all. now, the only remaining usage of _Noreturn is in public interfaces where _Noreturn is part of their contract.
This commit is contained in:
parent
95dfa3dd12
commit
54b7564b72
@ -8,7 +8,7 @@
|
||||
int main();
|
||||
weak void _init();
|
||||
weak void _fini();
|
||||
_Noreturn int __libc_start_main(int (*)(), int, char **,
|
||||
int __libc_start_main(int (*)(), int, char **,
|
||||
void (*)(), void(*)(), void(*)());
|
||||
|
||||
void _start_c(long *p)
|
||||
|
@ -5,10 +5,10 @@
|
||||
int main();
|
||||
weak void _init();
|
||||
weak void _fini();
|
||||
_Noreturn int __libc_start_main(int (*)(), int, char **,
|
||||
int __libc_start_main(int (*)(), int, char **,
|
||||
void (*)(), void(*)(), void(*)());
|
||||
|
||||
hidden _Noreturn void __dls2(unsigned char *base, size_t *sp)
|
||||
hidden void __dls2(unsigned char *base, size_t *sp)
|
||||
{
|
||||
__libc_start_main(main, *sp, (void *)(sp+1), _init, _fini, 0);
|
||||
}
|
||||
|
@ -1644,7 +1644,7 @@ hidden void __dls2(unsigned char *base, size_t *sp)
|
||||
* so that loads of the thread pointer and &errno can be pure/const and
|
||||
* thereby hoistable. */
|
||||
|
||||
_Noreturn void __dls2b(size_t *sp)
|
||||
void __dls2b(size_t *sp)
|
||||
{
|
||||
/* Setup early thread pointer in builtin_tls for ldso/libc itself to
|
||||
* use during dynamic linking. If possible it will also serve as the
|
||||
@ -1665,7 +1665,7 @@ _Noreturn void __dls2b(size_t *sp)
|
||||
* process dependencies and relocations for the main application and
|
||||
* transfer control to its entry point. */
|
||||
|
||||
_Noreturn void __dls3(size_t *sp)
|
||||
void __dls3(size_t *sp)
|
||||
{
|
||||
static struct dso app, vdso;
|
||||
size_t aux[AUX_CNT], *auxv;
|
||||
|
Loading…
Reference in New Issue
Block a user