diff options
author | Lei Zhang <thestig@chromium.org> | 2018-07-09 18:58:37 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-09 18:58:37 +0000 |
commit | 43f6bc80a29fdf326729903e9f323850e9553c69 (patch) | |
tree | 76683eacb9e8992853fea064110d1871b0c97947 /core | |
parent | 245c7310a74e1ed81c885b3404a8cedf0c58f4b8 (diff) | |
download | pdfium-43f6bc80a29fdf326729903e9f323850e9553c69.tar.xz |
Prevent FX_OutOfMemoryTerminate() from being folded by the linker.
Copy base::debug::Alias() from Chromium. Use it to prevent ICF from
combining FX_OutOfMemoryTerminate() with similar functions.
BUG=chromium:860850
Change-Id: Ifccb05c0218f86e44b9bb235847e01383ec36b3f
Reviewed-on: https://pdfium-review.googlesource.com/37290
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fxcrt/fx_memory.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/fxcrt/fx_memory.cpp b/core/fxcrt/fx_memory.cpp index 006e03031e..4c7b36855c 100644 --- a/core/fxcrt/fx_memory.cpp +++ b/core/fxcrt/fx_memory.cpp @@ -4,10 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <stdlib.h> // For abort(). + #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_safe_types.h" - -#include <stdlib.h> // For abort(). +#include "third_party/base/debug/alias.h" pdfium::base::PartitionAllocatorGeneric gArrayBufferPartitionAllocator; pdfium::base::PartitionAllocatorGeneric gGeneralPartitionAllocator; @@ -45,6 +46,11 @@ void FXMEM_DefaultFree(void* pointer) { } NEVER_INLINE void FX_OutOfMemoryTerminate() { + // Convince the linker this should not be folded with similar functions using + // Identical Code Folding. + static int make_this_function_aliased = 0xbd; + base::debug::Alias(&make_this_function_aliased); + // Termimate cleanly if we can, else crash at a specific address (0xbd). abort(); #ifndef _WIN32 |