--- ./src/3rdparty/chromium/base/debug/stack_trace.cc.orig +++ ./src/3rdparty/chromium/base/debug/stack_trace.cc @@ -144,7 +144,7 @@ #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. @@ -217,7 +217,9 @@ } void StackTrace::OutputToStream(std::ostream* os) const { +#if defined(__GLIBC__) && !defined(_AIX) OutputToStreamWithPrefix(os, nullptr); +#endif } std::string StackTrace::ToString() const { @@ -225,7 +227,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(); --- ./src/3rdparty/chromium/base/debug/elf_reader.cc.orig +++ ./src/3rdparty/chromium/base/debug/elf_reader.cc @@ -148,7 +148,12 @@ strtab_addr = static_cast(dynamic_iter->d_un.d_ptr) + reinterpret_cast(relocation_offset); #else - strtab_addr = reinterpret_cast(dynamic_iter->d_un.d_ptr); + if (dynamic_iter->d_un.d_ptr < relocation_offset) { + strtab_addr = static_cast(dynamic_iter->d_un.d_ptr) + + reinterpret_cast(relocation_offset); + } else { + strtab_addr = reinterpret_cast(dynamic_iter->d_un.d_ptr); + } #endif } else if (dynamic_iter->d_tag == DT_SONAME) { soname_strtab_offset = dynamic_iter->d_un.d_val; --- ./src/3rdparty/chromium/mojo/public/c/system/thunks.cc.orig +++ ./src/3rdparty/chromium/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; --- ./src/3rdparty/chromium/base/native_library_unittest.cc.orig +++ ./src/3rdparty/chromium/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) --- a/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc.orig +++ b/src/3rdparty/chromium/v8/src/codegen/external-reference-table.cc @@ -11,7 +11,9 @@ #if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) #define SYMBOLIZE_FUNCTION +#if defined(__GLIBC__) #include +#endif #include @@ -96,7 +98,7 @@ } 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 --- a/src/3rdparty/chromium/base/debug/stack_trace_posix.cc.orig +++ b/src/3rdparty/chromium/base/debug/stack_trace_posix.cc @@ -27,7 +27,7 @@ #if !defined(USE_SYMBOLIZE) #include #endif -#if !defined(__UCLIBC__) && !defined(_AIX) +#if defined(__GLIBC__) && !defined(_AIX) #include #endif @@ -88,7 +88,7 @@ // 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. @@ -135,7 +135,7 @@ 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. @@ -827,7 +827,7 @@ // 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) // Though the backtrace API man page does not list any possible negative // return values, we take no chance. return base::saturated_cast(backtrace(trace, count)); @@ -840,13 +840,13 @@ // 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);