This repository has been archived on 2023-01-08. You can view files and clone it, but cannot push or open issues or pull requests.
ptrcports/electron/musl-hacks.patch.chromium
2022-06-12 03:32:12 +02:00

98 lines
3.6 KiB
Text

--- ./base/debug/stack_trace.cc
+++ ./base/debug/stack_trace.cc
@@ -168,7 +168,7 @@
#if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS)
uintptr_t GetStackEnd() {
-#if BUILDFLAG(IS_ANDROID)
+#if BUILDFLAG(IS_ANDROID) || (defined(OS_LINUX) && !defined(__GLIBC__))
// Bionic reads proc/maps on every call to pthread_getattr_np() when called
// from the main thread. So we need to cache end of stack in that case to get
// acceptable performance.
@@ -234,8 +234,10 @@
defined(MEMORY_SANITIZER)
// Sanitizer configurations (ASan, TSan, MSan) emit unsymbolized stacks.
return false;
-#else
+#elif defined(__GLIBC__)
return true;
+#else
+ return false;
#endif
}
@@ -251,7 +253,9 @@
}
void StackTrace::OutputToStream(std::ostream* os) const {
+#if defined(__GLIBC__) && !defined(_AIX)
OutputToStreamWithPrefix(os, nullptr);
+#endif
}
std::string StackTrace::ToString() const {
@@ -259,7 +263,7 @@
}
std::string StackTrace::ToStringWithPrefix(const char* prefix_string) const {
std::stringstream stream;
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(_AIX)
OutputToStreamWithPrefix(&stream, prefix_string);
#endif
return stream.str();
--- ./net/socket/udp_socket_posix.cc
+++ ./net/socket/udp_socket_posix.cc
@@ -1191,7 +1191,7 @@
msg_iov->push_back({const_cast<char*>(buffer->data()), buffer->length()});
msgvec->reserve(buffers.size());
for (size_t j = 0; j < buffers.size(); j++)
- msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, nullptr, 0, 0}, 0});
+ msgvec->push_back({{nullptr, 0, &msg_iov[j], 1, 0, 0, 0}, 0});
int result = HANDLE_EINTR(Sendmmsg(fd, &msgvec[0], buffers.size(), 0));
SendResult send_result(0, 0, std::move(buffers));
if (result < 0) {
--- ./base/debug/elf_reader.cc.orig
+++ ./base/debug/elf_reader.cc
@@ -149,7 +149,12 @@
strtab_addr = static_cast<size_t>(dynamic_iter->d_un.d_ptr) +
reinterpret_cast<const char*>(relocation_offset);
#else
- strtab_addr = reinterpret_cast<const char*>(dynamic_iter->d_un.d_ptr);
+ if (dynamic_iter->d_un.d_ptr < relocation_offset) {
+ strtab_addr = static_cast<size_t>(dynamic_iter->d_un.d_ptr) +
+ reinterpret_cast<const char*>(relocation_offset);
+ } else {
+ strtab_addr = reinterpret_cast<const char*>(dynamic_iter->d_un.d_ptr);
+ }
#endif
} else if (dynamic_iter->d_tag == DT_SONAME) {
soname_strtab_offset = dynamic_iter->d_un.d_val;
--- ./mojo/public/c/system/thunks.cc.orig
+++ ./mojo/public/c/system/thunks.cc
@@ -100,7 +100,8 @@
base::ScopedAllowBlocking allow_blocking;
base::NativeLibraryOptions library_options;
#if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \
- !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER)
+ !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) && \
+ defined(RTLD_DEEPBIND)
// Sanitizer builds cannnot support RTLD_DEEPBIND, but they also disable
// allocator shims, so it's unnecessary there.
library_options.prefer_own_symbols = true;
--- ./base/native_library_unittest.cc.orig
+++ ./base/native_library_unittest.cc
@@ -121,6 +121,7 @@
#if !defined(OS_ANDROID) && !defined(THREAD_SANITIZER) && \
!defined(MEMORY_SANITIZER)
+#if defined(RTLD_DEEPBIND)
// Verifies that the |prefer_own_symbols| option satisfies its guarantee that
// a loaded library will always prefer local symbol resolution before
// considering global symbols.
@@ -156,6 +157,7 @@
EXPECT_EQ(2, NativeLibraryTestIncrement());
EXPECT_EQ(3, NativeLibraryTestIncrement());
}
+#endif // defined(RTLD_DEEPBIND)
#endif // !defined(OS_ANDROID)