summaryrefslogtreecommitdiff
path: root/repo/chromium/musl-hacks.patch
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-31 11:05:19 +0100
committerdavidovski <david@davidovski.xyz>2022-05-31 11:05:19 +0100
commit48ca75555522716f0f686dcae3dd6cf3d8ad714d (patch)
tree00c0f58550ba4661e87376f2f02c8001c69bae44 /repo/chromium/musl-hacks.patch
parent871b2b573f01c1b3176a0f65458b3d281b41c437 (diff)
removed idea of repos
Diffstat (limited to 'repo/chromium/musl-hacks.patch')
-rw-r--r--repo/chromium/musl-hacks.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/repo/chromium/musl-hacks.patch b/repo/chromium/musl-hacks.patch
new file mode 100644
index 0000000..93db25a
--- /dev/null
+++ b/repo/chromium/musl-hacks.patch
@@ -0,0 +1,98 @@
+--- ./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)