about summary refs log tree commit diff
path: root/crt
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-06-25 18:50:05 -0400
committerRich Felker <dalias@aerifal.cx>2019-06-25 19:05:40 -0400
commit54b7564b72c1edcc79fca083047521fb56eaea00 (patch)
tree4756518df5e03dc40701b157fec55e7f54e414e7 /crt
parent95dfa3dd12108f42b23a1083e7b32266246a3590 (diff)
downloadmusl-54b7564b72c1edcc79fca083047521fb56eaea00.tar.gz
musl-54b7564b72c1edcc79fca083047521fb56eaea00.tar.xz
musl-54b7564b72c1edcc79fca083047521fb56eaea00.zip
remove unnecessary and problematic _Noreturn from crt/ldso startup
after commit a48ccc159a5fa061a18419296100ee48a1cd6cc9 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 commit 4390383b32250a941ec616e8bff6f568a801b1c0, 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.
Diffstat (limited to 'crt')
-rw-r--r--crt/crt1.c2
-rw-r--r--crt/rcrt1.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/crt/crt1.c b/crt/crt1.c
index 7b12665f..8fe8ab5d 100644
--- a/crt/crt1.c
+++ b/crt/crt1.c
@@ -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)
diff --git a/crt/rcrt1.c b/crt/rcrt1.c
index 7bb3322f..901dff68 100644
--- a/crt/rcrt1.c
+++ b/crt/rcrt1.c
@@ -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);
 }