Skip to content

Commit

Permalink
Prevent sk_abort_no_print() from being folded by the linker.
Browse files Browse the repository at this point in the history
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 <thakis@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573434}
  • Loading branch information
leizleiz authored and Commit Bot committed Jul 9, 2018
1 parent f4590fb commit 026cfc6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions skia/ext/SkMemory_new_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <stddef.h>
#include <stdlib.h>

#include "base/debug/alias.h"
#include "base/process/memory.h"
#include "build/build_config.h"
#include "third_party/skia/include/core/SkTypes.h"
Expand All @@ -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();
}

Expand Down

0 comments on commit 026cfc6

Please sign in to comment.