From 026cfc6cd1e24808dd1baf57992cee34dfe20799 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 9 Jul 2018 20:53:49 +0000 Subject: [PATCH] Prevent sk_abort_no_print() from being folded by the linker. Use base::debug::Alias() to prevent ICF from combining Chromium's port of sk_abort_no_print() with similar functions. BUG=860850 Change-Id: I3c45d7aa567c2bdd2098a355cbf2e56a8e82bb34 Reviewed-on: https://chromium-review.googlesource.com/1128459 Reviewed-by: Nico Weber Commit-Queue: Lei Zhang Cr-Commit-Position: refs/heads/master@{#573434} --- skia/ext/SkMemory_new_handler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/skia/ext/SkMemory_new_handler.cpp b/skia/ext/SkMemory_new_handler.cpp index 42ce498a9c918e..a6ae3c36b34ef2 100644 --- a/skia/ext/SkMemory_new_handler.cpp +++ b/skia/ext/SkMemory_new_handler.cpp @@ -5,6 +5,7 @@ #include #include +#include "base/debug/alias.h" #include "base/process/memory.h" #include "build/build_config.h" #include "third_party/skia/include/core/SkTypes.h" @@ -30,6 +31,13 @@ static inline void* throw_on_failure(size_t size, void* p) { } void sk_abort_no_print() { + // Linker's ICF feature may merge this function with other functions with + // the same definition (e.g. any function whose sole job is to call abort()) + // and it may confuse the crash report processing system. + // http://crbug.com/860850 + static int static_variable_to_make_this_function_unique = 0x736b; // "sk" + base::debug::Alias(&static_variable_to_make_this_function_unique); + abort(); }