summaryrefslogtreecommitdiff
path: root/src/g10lib.h
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2020-11-07 10:30:05 +0200
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2020-12-03 20:55:51 +0200
commit1a83df98b198902ee6d71549231a3af37088d452 (patch)
treed5855d5b65566302b67eb38b24636b3338433efb /src/g10lib.h
parent2065720b5b0642cc1a0e08086a434244ebb1abf2 (diff)
downloadlibgcrypt-1a83df98b198902ee6d71549231a3af37088d452.tar.gz
Prevent link-time optimization from inlining __gcry_burn_stack
* src/g10lib.h (NOINLINE_FUNC): New attribute macro. * src/misc.c (__gcry_burn_stack): Add NOINLINE_FUNC attribute. -- LTO can cause inline of __gcry_burn_stack and result tail-call to _gcry_fast_wipememory and defeat tail-call prevention in _gcry_burn_stack macro. Mark __gcry_burn_stack with 'noinline' attribute to prevent unwanted inlining of this function in LTO builds. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'src/g10lib.h')
-rw-r--r--src/g10lib.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/g10lib.h b/src/g10lib.h
index c85e6649..ffd71018 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -75,6 +75,12 @@
#define GCC_ATTR_UNUSED
#endif
+#if __GNUC__ > 3
+#define NOINLINE_FUNC __attribute__((noinline))
+#else
+#define NOINLINE_FUNC
+#endif
+
#if __GNUC__ >= 3
#define LIKELY(expr) __builtin_expect( !!(expr), 1 )
#define UNLIKELY(expr) __builtin_expect( !!(expr), 0 )