summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-26 00:02:58 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-26 00:02:58 +0100
commit2c8a7766681b704e710f51c0817534e3f9a952d1 (patch)
tree241e47b7d02db7e09e8616d7c181f7e53cfce1a3
parent9e552e6a2d836698834d2bf887dbf1806172729f (diff)
ldso: mark _dl_exit as noreturn
Otherwise gcc might not understand that oom() ended control-flow and might emit an (untaken) reference to abort() in _dl_update_slotinfo() on e.g. SH4 which breaks linking ld-uClibc.so. Arguably -ffreestanding should prevent GCC from emitting this '.global abort' but alas, it does not, which is another bug.. Also mark the function cold to further lower the incoming frequency and branch probability. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--ldso/include/dl-syscall.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h
index 675b93ae8..e556f7b56 100644
--- a/ldso/include/dl-syscall.h
+++ b/ldso/include/dl-syscall.h
@@ -52,7 +52,15 @@ extern int _dl_errno;
dynamic linking at all, so we cannot return any error codes.
We just punt if there is an error. */
#define __NR__dl_exit __NR_exit
-static __always_inline _syscall1(void, _dl_exit, int, status)
+static __always_inline attribute_noreturn __cold void _dl_exit(int status)
+{
+ INLINE_SYSCALL(_dl_exit, 1, status);
+#if defined __GNUC__
+ __builtin_unreachable(); /* shut up warning: 'noreturn' function does return*/
+#else
+ while (1);
+#endif
+}
#define __NR__dl_close __NR_close
static __always_inline _syscall1(int, _dl_close, int, fd)