[compiler-rt] r323795 - [scudo] Add default implementations for weak functions
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 09:59:50 PST 2018
Author: cryptoad
Date: Tue Jan 30 09:59:49 2018
New Revision: 323795
URL: http://llvm.org/viewvc/llvm-project?rev=323795&view=rev
Log:
[scudo] Add default implementations for weak functions
Summary:
This is in preparation for platforms where `SANITIZER_SUPPORTS_WEAK_HOOKS` is 0.
They require a default implementation.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D42557
Modified:
compiler-rt/trunk/lib/scudo/scudo_allocator.cpp
compiler-rt/trunk/lib/scudo/scudo_flags.cpp
compiler-rt/trunk/lib/scudo/scudo_interface_internal.h
Modified: compiler-rt/trunk/lib/scudo/scudo_allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_allocator.cpp?rev=323795&r1=323794&r2=323795&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_allocator.cpp (original)
+++ compiler-rt/trunk/lib/scudo/scudo_allocator.cpp Tue Jan 30 09:59:49 2018
@@ -736,6 +736,18 @@ uptr __sanitizer_get_allocated_size(cons
return Instance.getUsableSize(Ptr);
}
+#if !SANITIZER_SUPPORTS_WEAK_HOOKS
+SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_malloc_hook,
+ void *Ptr, uptr Size) {
+ (void)Ptr;
+ (void)Size;
+}
+
+SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_free_hook, void *Ptr) {
+ (void)Ptr;
+}
+#endif
+
// Interface functions
void __scudo_set_rss_limit(uptr LimitMb, s32 HardLimit) {
Modified: compiler-rt/trunk/lib/scudo/scudo_flags.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_flags.cpp?rev=323795&r1=323794&r2=323795&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_flags.cpp (original)
+++ compiler-rt/trunk/lib/scudo/scudo_flags.cpp Tue Jan 30 09:59:49 2018
@@ -12,13 +12,12 @@
//===----------------------------------------------------------------------===//
#include "scudo_flags.h"
+#include "scudo_interface_internal.h"
#include "scudo_utils.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_flag_parser.h"
-SANITIZER_INTERFACE_WEAK_DEF(const char*, __scudo_default_options, void);
-
namespace __scudo {
static Flags ScudoFlags; // Use via getFlags().
@@ -119,3 +118,9 @@ Flags *getFlags() {
}
} // namespace __scudo
+
+#if !SANITIZER_SUPPORTS_WEAK_HOOKS
+SANITIZER_INTERFACE_WEAK_DEF(const char*, __scudo_default_options, void) {
+ return "";
+}
+#endif
Modified: compiler-rt/trunk/lib/scudo/scudo_interface_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/scudo/scudo_interface_internal.h?rev=323795&r1=323794&r2=323795&view=diff
==============================================================================
--- compiler-rt/trunk/lib/scudo/scudo_interface_internal.h (original)
+++ compiler-rt/trunk/lib/scudo/scudo_interface_internal.h Tue Jan 30 09:59:49 2018
@@ -20,6 +20,9 @@ using __sanitizer::uptr;
using __sanitizer::s32;
extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+const char* __scudo_default_options();
+
SANITIZER_INTERFACE_ATTRIBUTE
void __scudo_set_rss_limit(uptr LimitMb, s32 HardLimit);
} // extern "C"
More information about the llvm-commits
mailing list