Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions boring-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,11 @@ fn ensure_patches_applied(config: &Config) -> io::Result<()> {
apply_patch(config, "underscore-wildcards.patch")?;
}

if config.target_os == "android" {
println!("cargo:warning=disabling weak allocator hooks on Android");
apply_patch(config, "android-local-memory-hooks.patch")?;
}

Ok(())
}

Expand Down
13 changes: 13 additions & 0 deletions boring-sys/patches/android-local-memory-hooks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/crypto/mem.c b/src/crypto/mem.c
index e4398d1a7..71e533524 100644
--- a/src/crypto/mem.c
+++ b/src/crypto/mem.c
@@ -94,7 +94,7 @@ static void __asan_unpoison_memory_region(const void *addr, size_t size) {}
// Windows doesn't really support weak symbols as of May 2019, and Clang on
// Windows will emit strong symbols instead. See
// https://bugs.llvm.org/show_bug.cgi?id=37598
-#if defined(__ELF__) && defined(__GNUC__)
+#if defined(__ELF__) && defined(__GNUC__) && !defined(__ANDROID__)
#define WEAK_SYMBOL_FUNC(rettype, name, args) \
rettype name args __attribute__((weak));
#else