From ca99df8edb30929c6f6f433dc5373f1cd5bc18ce Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 8 Aug 2019 16:12:52 -0700 Subject: [PATCH] ircd::assert: Always inline the debugtrap. --- include/ircd/assert.h | 14 ++++++++++++++ ircd/assert.cc | 16 ---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/include/ircd/assert.h b/include/ircd/assert.h index 79f79999a..18813abb5 100644 --- a/include/ircd/assert.h +++ b/include/ircd/assert.h @@ -52,3 +52,17 @@ __assert(const char *__assertion, int __line); #endif + +extern inline void +__attribute__((always_inline, gnu_inline, artificial)) +ircd::debugtrap() +{ + #if defined(__clang__) + static_assert(__has_builtin(__builtin_debugtrap)); + __builtin_debugtrap(); + #elif defined(__x86_64__) + __asm__ volatile ("int $3"); + #else + __builtin_trap(); + #endif +} diff --git a/ircd/assert.cc b/ircd/assert.cc index 0d21ccfc4..703d47459 100644 --- a/ircd/assert.cc +++ b/ircd/assert.cc @@ -97,19 +97,3 @@ __assert_fail(const char *__assertion, #pragma clang diagnostic pop #endif __clang__ #endif - -void -__attribute__((visibility("default"))) -ircd::debugtrap() -{ - #if defined(__clang__) - static_assert(__has_builtin(__builtin_debugtrap)); - __builtin_debugtrap(); - #elif defined(__x86_64__) - __asm__ volatile ("int $3"); - #elif defined(HAVE_SIGNAL_H) - raise(SIGTRAP); - #else - __builtin_trap(); - #endif -}