Skip to content

Instantly share code, notes, and snippets.

@cztomczak
Last active February 23, 2021 14:30
Show Gist options
  • Save cztomczak/ec6067cf8c04a2dc4335661eb9245ae4 to your computer and use it in GitHub Desktop.
Save cztomczak/ec6067cf8c04a2dc4335661eb9245ae4 to your computer and use it in GitHub Desktop.
Patch to fix build issues when disabling allocator shim for Linux. Tested with CEF branch 3945.
diff --git a/patch/patch.cfg b/patch/patch.cfg
index 6b6e143e..ead726ee 100644
--- a/patch/patch.cfg
+++ b/patch/patch.cfg
@@ -495,5 +495,9 @@ patches = [
# https://chromium-review.googlesource.com/c/chromium/src/+/1903768
# https://bugs.chromium.org/p/chromium/issues/detail?id=1008523#c61
'name': 'blink_layout_inline_1008523',
- }
+ },
+ {
+ # Fix compile errors on Linux when disabling both tcmalloc and allocator shim.
+ 'name': 'linux_memory',
+ },
]
diff --git a/patch/patches/linux_memory.patch b/patch/patches/linux_memory.patch
new file mode 100644
index 00000000..12df11d6
--- /dev/null
+++ b/patch/patches/linux_memory.patch
@@ -0,0 +1,22 @@
+diff --git base/process/memory_linux.cc base/process/memory_linux.cc
+index 483168b..507fae6 100644
+--- base/process/memory_linux.cc
++++ base/process/memory_linux.cc
+@@ -23,6 +23,17 @@
+ #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h"
+ #endif
+
++#if !BUILDFLAG(USE_TCMALLOC) && !BUILDFLAG(USE_ALLOCATOR_SHIM) && defined(LIBC_GLIBC)
++extern "C" {
++void* __libc_malloc(size_t size);
++void* __libc_calloc(size_t n, size_t size);
++void* __libc_realloc(void* address, size_t size);
++void* __libc_memalign(size_t alignment, size_t size);
++void __libc_free(void* ptr);
++} // extern "C"
++
++#endif
++
+ namespace base {
+
+ size_t g_oom_size = 0U;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment