From d48bf6b3adad65756ed79b843b85409aa34459f8 Mon Sep 17 00:00:00 2001 From: Aliaksey Kandratsenka Date: Wed, 27 Sep 2023 21:37:30 -0400 Subject: [PATCH] force inline do_mmap_with_hooks Otherwise mmap calling to do_mmap_with_hooks might tail-call (instead of inlining), which will then break GetCallerStackTrace facility (since only mmap is placed into special malloc_hook section). This unbreaks heap checker on gcc 5, but is in general right thing to do. --- src/mmap_hook.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mmap_hook.cc b/src/mmap_hook.cc index 0b9aa08..c26c647 100644 --- a/src/mmap_hook.cc +++ b/src/mmap_hook.cc @@ -223,7 +223,8 @@ static void* do_mmap(void* start, size_t length, int prot, int flags, int fd, in #ifdef DEFINED_DO_MMAP -static void* do_mmap_with_hooks(void* start, size_t length, int prot, int flags, int fd, int64_t offset) { +static inline ATTRIBUTE_ALWAYS_INLINE +void* do_mmap_with_hooks(void* start, size_t length, int prot, int flags, int fd, int64_t offset) { void* result = do_mmap(start, length, prot, flags, fd, offset); if (result == MAP_FAILED) { return result;