pkgs/musl/0003-scudo-clean-up-lingering-weak-symbols-we-don-t-want.patch

92 lines
2.9 KiB
Diff
Raw Normal View History

2023-12-11 13:18:00 +00:00
From ab2da75af3f57c3090da91f98c23935af17cfa5d Mon Sep 17 00:00:00 2001
2023-12-08 20:54:14 +00:00
From: Daniel Kolesa <daniel@octaforge.org>
Date: Fri, 9 Dec 2022 00:15:57 +0100
2023-12-11 13:18:00 +00:00
Subject: [PATCH 3/6] scudo: clean up lingering weak symbols we don't want
2023-12-08 20:54:14 +00:00
---
src/malloc/scudo/checksum.h | 2 +-
src/malloc/scudo/combined.h | 2 +-
src/malloc/scudo/crc32_hw.cpp | 4 ++++
src/malloc/scudo/linux.cpp | 7 +++++++
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/malloc/scudo/checksum.h b/src/malloc/scudo/checksum.h
index f8eda81f..d61b6d88 100644
--- a/src/malloc/scudo/checksum.h
+++ b/src/malloc/scudo/checksum.h
@@ -52,7 +52,7 @@ inline u16 computeBSDChecksum(u16 Sum, uptr Data) {
}
bool hasHardwareCRC32();
-WEAK u32 computeHardwareCRC32(u32 Crc, uptr Data);
+u32 computeHardwareCRC32(u32 Crc, uptr Data);
} // namespace scudo
diff --git a/src/malloc/scudo/combined.h b/src/malloc/scudo/combined.h
index b17acc71..e62c9177 100644
--- a/src/malloc/scudo/combined.h
+++ b/src/malloc/scudo/combined.h
@@ -139,7 +139,7 @@ public:
// Check if hardware CRC32 is supported in the binary and by the platform,
// if so, opt for the CRC32 hardware version of the checksum.
- if (&computeHardwareCRC32 && hasHardwareCRC32())
+ if (hasHardwareCRC32())
HashAlgorithm = Checksum::HardwareCRC32;
if (UNLIKELY(!getRandom(&Cookie, sizeof(Cookie))))
diff --git a/src/malloc/scudo/crc32_hw.cpp b/src/malloc/scudo/crc32_hw.cpp
index 73f2ae00..4fe16933 100644
--- a/src/malloc/scudo/crc32_hw.cpp
+++ b/src/malloc/scudo/crc32_hw.cpp
@@ -14,6 +14,10 @@ namespace scudo {
u32 computeHardwareCRC32(u32 Crc, uptr Data) {
return static_cast<u32>(CRC32_INTRINSIC(Crc, Data));
}
+#else
+u32 computeHardwareCRC32(u32, uptr) {
+ return 0;
+}
#endif // defined(__CRC32__) || defined(__SSE4_2__) ||
// defined(__ARM_FEATURE_CRC32)
diff --git a/src/malloc/scudo/linux.cpp b/src/malloc/scudo/linux.cpp
index e285d8a3..b4603966 100644
--- a/src/malloc/scudo/linux.cpp
+++ b/src/malloc/scudo/linux.cpp
@@ -193,9 +193,11 @@ bool getRandom(void *Buffer, uptr Length, UNUSED bool Blocking) {
return (ReadBytes == static_cast<ssize_t>(Length));
}
+#if SCUDO_ANDROID
// Allocation free syslog-like API.
extern "C" WEAK int async_safe_write_log(int pri, const char *tag,
const char *msg);
+#endif
static uptr GetRSSFromBuffer(const char *Buf) {
// The format of the file is:
@@ -230,6 +232,7 @@ uptr GetRSS() {
return GetRSSFromBuffer(Buf);
}
+#if SCUDO_ANDROID
void outputRaw(const char *Buffer) {
if (&async_safe_write_log) {
constexpr s32 AndroidLogInfo = 4;
@@ -262,6 +265,10 @@ void setAbortMessage(const char *Message) {
if (&android_set_abort_message)
android_set_abort_message(Message);
}
+#else
+void outputRaw(const char *) {}
+void setAbortMessage(const char *) {}
+#endif
} // namespace scudo
--
2.43.0