1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-15 04:05:15 +03:00
aports/testing/qt6-qtwebengine/0006-musl-hacks.patch
2022-05-09 18:38:14 +00:00

181 lines
7.8 KiB
Diff

diff --git a/src/3rdparty/chromium/base/debug/elf_reader.cc b/src/3rdparty/chromium/base/debug/elf_reader.cc
index 472d0ebd7..eaf6aeadf 100644
--- a/src/3rdparty/chromium/base/debug/elf_reader.cc
+++ b/src/3rdparty/chromium/base/debug/elf_reader.cc
@@ -149,7 +149,12 @@ absl::optional<StringPiece> ReadElfLibraryName(const void* elf_mapped_base) {
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;
diff --git a/src/3rdparty/chromium/base/debug/stack_trace.cc b/src/3rdparty/chromium/base/debug/stack_trace.cc
index bd4763b44..106775ae5 100644
--- a/src/3rdparty/chromium/base/debug/stack_trace.cc
+++ b/src/3rdparty/chromium/base/debug/stack_trace.cc
@@ -146,7 +146,7 @@ void* LinkStackFrames(void* fpp, void* parent_fp) {
#if BUILDFLAG(CAN_UNWIND_WITH_FRAME_POINTERS)
uintptr_t GetStackEnd() {
-#if defined(OS_ANDROID)
+#if defined(OS_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.
@@ -252,7 +252,9 @@ void StackTrace::Print() const {
}
void StackTrace::OutputToStream(std::ostream* os) const {
+#if defined(__GLIBC__) && !defined(_AIX)
OutputToStreamWithPrefix(os, nullptr);
+#endif
}
std::string StackTrace::ToString() const {
@@ -260,7 +262,7 @@ std::string StackTrace::ToString() const {
}
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();
diff --git a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
index 8833b20ef..362fad5f3 100644
--- a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
+++ b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc
@@ -27,7 +27,7 @@
#if !defined(USE_SYMBOLIZE)
#include <cxxabi.h>
#endif
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(_AIX)
#include <execinfo.h>
#endif
@@ -89,7 +89,7 @@ void DemangleSymbols(std::string* text) {
// Note: code in this function is NOT async-signal safe (std::string uses
// malloc internally).
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(_AIX)
std::string::size_type search_from = 0;
while (search_from < text->size()) {
// Look for the start of a mangled symbol, from search_from.
@@ -124,7 +124,7 @@ void DemangleSymbols(std::string* text) {
search_from = mangled_start + 2;
}
}
-#endif // !defined(__UCLIBC__) && !defined(_AIX)
+#endif // !defined(__GLIBC__) && !defined(_AIX)
}
#endif // !defined(USE_SYMBOLIZE)
@@ -136,7 +136,7 @@ class BacktraceOutputHandler {
virtual ~BacktraceOutputHandler() = default;
};
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(_AIX)
void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
// This should be more than enough to store a 64-bit number in hex:
// 16 hex digits + 1 for null-terminator.
@@ -219,7 +219,7 @@ void ProcessBacktrace(void* const* trace,
}
#endif // defined(USE_SYMBOLIZE)
}
-#endif // !defined(__UCLIBC__) && !defined(_AIX)
+#endif // !defined(__GLIBC__) && !defined(_AIX)
void PrintToStderr(const char* output) {
// NOTE: This code MUST be async-signal safe (it's used by in-process
@@ -839,7 +839,7 @@ size_t CollectStackTrace(void** trace, size_t count) {
// If we do not have unwind tables, then try tracing using frame pointers.
return base::debug::TraceStackFramePointers(const_cast<const void**>(trace),
count, 0);
-#elif !defined(__UCLIBC__) && !defined(_AIX)
+#elif !defined(__GLIBC__) && !defined(_AIX)
// Though the backtrace API man page does not list any possible negative
// return values, we take no chance.
return base::saturated_cast<size_t>(backtrace(trace, count));
@@ -852,13 +852,13 @@ void StackTrace::PrintWithPrefix(const char* prefix_string) const {
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(_AIX)
PrintBacktraceOutputHandler handler;
ProcessBacktrace(trace_, count_, prefix_string, &handler);
#endif
}
-#if !defined(__UCLIBC__) && !defined(_AIX)
+#if defined(__GLIBC__) && !defined(_AIX)
void StackTrace::OutputToStreamWithPrefix(std::ostream* os,
const char* prefix_string) const {
StreamBacktraceOutputHandler handler(os);
diff --git a/src/3rdparty/chromium/base/native_library_unittest.cc b/src/3rdparty/chromium/base/native_library_unittest.cc
index 796451440..a4d0186fd 100644
--- a/src/3rdparty/chromium/base/native_library_unittest.cc
+++ b/src/3rdparty/chromium/base/native_library_unittest.cc
@@ -121,6 +121,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
#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 @@ TEST(NativeLibraryTest, LoadLibraryPreferOwnSymbols) {
EXPECT_EQ(2, NativeLibraryTestIncrement());
EXPECT_EQ(3, NativeLibraryTestIncrement());
}
+#endif // defined(RTLD_DEEPBIND)
#endif // !defined(OS_ANDROID)
diff --git a/src/3rdparty/chromium/mojo/public/c/system/thunks.cc b/src/3rdparty/chromium/mojo/public/c/system/thunks.cc
index d7dc6e3d8..5cb40a21b 100644
--- a/src/3rdparty/chromium/mojo/public/c/system/thunks.cc
+++ b/src/3rdparty/chromium/mojo/public/c/system/thunks.cc
@@ -100,7 +100,8 @@ class CoreLibraryInitializer {
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;
diff --git a/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc b/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc
index 0a22fbdd7..651f5139c 100644
--- a/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc
+++ b/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc
@@ -12,7 +12,9 @@
#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID)
#define SYMBOLIZE_FUNCTION
+#if defined(__GLIBC__)
#include <execinfo.h>
+#endif
#include <vector>
@@ -103,7 +105,7 @@ void ExternalReferenceTable::Init(Isolate* isolate) {
}
const char* ExternalReferenceTable::ResolveSymbol(void* address) {
-#ifdef SYMBOLIZE_FUNCTION
+#if defined(SYMBOLIZE_FUNCTION) && defined(__GLIBC__)
char** names = backtrace_symbols(&address, 1);
const char* name = names[0];
// The array of names is malloc'ed. However, each name string is static