void-packages/srcpkgs/chromium/files/musl-patches/musl-fixes.patch

224 lines
7.9 KiB
Diff

--- ./third_party/lss/linux_syscall_support.h.orig
+++ ./third_party/lss/linux_syscall_support.h
@@ -1127,6 +1127,12 @@
#ifndef __NR_fallocate
#define __NR_fallocate 285
#endif
+
+#undef __NR_pread
+#define __NR_pread __NR_pread64
+#undef __NR_pwrite
+#define __NR_pwrite __NR_pwrite64
+
/* End of x86-64 definitions */
#elif defined(__mips__)
#if _MIPS_SIM == _MIPS_SIM_ABI32
--- ./third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h.orig
+++ ./third_party/breakpad/breakpad/src/client/linux/dump_writer_common/ucontext_reader.h
@@ -37,6 +37,10 @@
#include "common/memory.h"
#include "google_breakpad/common/minidump_format.h"
+#if !defined(__GLIBC__)
+ #define _libc_fpstate _fpstate
+#endif
+
namespace google_breakpad {
// Wraps platform-dependent implementations of accessors to ucontext_t structs.
--- ./third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h.orig
+++ ./third_party/breakpad/breakpad/src/common/linux/elf_core_dump.h
@@ -36,6 +36,7 @@
#include <elf.h>
#include <link.h>
#include <stddef.h>
+#include <limits.h>
#include "common/memory_range.h"
--- ./sandbox/linux/suid/process_util.h.orig
+++ ./sandbox/linux/suid/process_util.h
@@ -11,6 +11,14 @@
#include <stdbool.h>
#include <sys/types.h>
+// Some additional functions
+# define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+
// This adjusts /proc/process/oom_score_adj so the Linux OOM killer
// will prefer certain process types over others. The range for the
// adjustment is [-1000, 1000], with [0, 1000] being user accessible.
--- ./sandbox/linux/seccomp-bpf/trap.cc.orig 2020-04-12 08:26:40.184159217 -0400
+++ ./sandbox/linux/seccomp-bpf/trap.cc 2020-04-12 08:46:16.737191222 -0400
@@ -174,7 +174,7 @@
// If the version of glibc doesn't include this information in
// siginfo_t (older than 2.17), we need to explicitly copy it
// into an arch_sigsys structure.
- memcpy(&sigsys, &info->_sifields, sizeof(sigsys));
+ memcpy(&sigsys, &info->__sifields, sizeof(sigsys));
#endif
#if defined(__mips__)
--- ./third_party/ffmpeg/libavutil/cpu.c.orig
+++ ./third_party/ffmpeg/libavutil/cpu.c
@@ -38,7 +38,6 @@
#include <sys/param.h>
#endif
#include <sys/types.h>
-#include <sys/sysctl.h>
#endif
#if HAVE_UNISTD_H
#include <unistd.h>
diff --git a/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc b/chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc.orig 2021-03-10 07:23:00.145810088 -0500
+++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc 2021-03-10 10:57:19.405962671 -0500
@@ -55,7 +55,9 @@
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(__GLIBC__)
#include <gnu/libc-version.h>
+#endif
#include "base/linux_util.h"
#include "base/strings/string_split.h"
@@ -316,7 +318,7 @@
void RecordLinuxGlibcVersion() {
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
-#if defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+#if defined(__GLIBC__) || BUILDFLAG(IS_CHROMEOS_LACROS)
base::Version version(gnu_get_libc_version());
UMALinuxGlibcVersion glibc_version_result = UMA_LINUX_GLIBC_NOT_PARSEABLE;
--- services/device/serial/serial_io_handler_posix.cc.orig 2019-07-03 10:57:32.568171835 -0400
+++ services/device/serial/serial_io_handler_posix.cc 2019-07-03 10:57:16.867983031 -0400
@@ -6,6 +6,7 @@
#include <sys/ioctl.h>
#include <termios.h>
+#include <asm-generic/ioctls.h>
#include <algorithm>
#include <utility>
diff --git a/third_party/ots/include/opentype-sanitiser.h b/third_party/ots/include/opentype-sanitiser.h
--- third_party/ots/src/include/opentype-sanitiser.h
+++ third_party/ots/src/include/opentype-sanitiser.h
@@ -20,6 +20,7 @@ typedef unsigned __int64 uint64_t;
#define htonl(x) _byteswap_ulong (x)
#define htons(x) _byteswap_ushort (x)
#else
+#include <sys/types.h>
#include <arpa/inet.h>
#include <stdint.h>
#endif
--- ./base/logging.cc.orig 2021-01-20 12:09:54.227038757 -0500
+++ ./base/logging.cc 2021-01-20 12:24:32.600301351 -0500
@@ -557,8 +557,7 @@
LogMessage::~LogMessage() {
size_t stack_start = stream_.tellp();
-#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && !defined(__UCLIBC__) && \
- !defined(OS_AIX)
+#if !defined(OFFICIAL_BUILD) && !defined(OS_NACL) && defined(__GLIBC__)
if (severity_ == LOGGING_FATAL && !base::debug::BeingDebugged()) {
// Include a stack trace on a fatal, unless a debugger is attached.
base::debug::StackTrace stack_trace;
--- ./third_party/blink/renderer/platform/wtf/stack_util.cc.orig
+++ ./third_party/blink/renderer/platform/wtf/stack_util.cc
@@ -28,7 +28,7 @@
// FIXME: On Mac OSX and Linux, this method cannot estimate stack size
// correctly for the main thread.
-#elif defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+#elif defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
defined(OS_FUCHSIA)
// pthread_getattr_np() can fail if the thread is not invoked by
// pthread_create() (e.g., the main thread of blink_unittests).
@@ -96,7 +96,7 @@
}
void* GetStackStart() {
-#if defined(__GLIBC__) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
+#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_FREEBSD) || \
defined(OS_FUCHSIA)
pthread_attr_t attr;
int error;
--- ./net/dns/dns_config_service_posix.cc.orig
+++ ./net/dns/dns_config_service_posix.cc
@@ -122,7 +122,7 @@
ConfigParsePosixResult result;
config->unhandled_options = false;
// TODO(fuchsia): Use res_ninit() when it's implemented on Fuchsia.
-#if defined(OS_OPENBSD) || defined(OS_FUCHSIA)
+#if defined(OS_OPENBSD) || defined(OS_FUCHSIA) || defined(_GNU_SOURCE)
// Note: res_ninit in glibc always returns 0 and sets RES_INIT.
// res_init behaves the same way.
memset(&_res, 0, sizeof(_res));
--- third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc.orig 2019-06-18 11:51:17.000000000 -0400
+++ third_party/swiftshader/third_party/llvm-subzero/lib/Support/Unix/Signals.inc 2019-07-03 12:32:50.938758186 -0400
@@ -25,7 +25,7 @@
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <string>
-#if HAVE_EXECINFO_H
+#if HAVE_EXECINFO_H && defined(__GLIBC__)
# include <execinfo.h> // For backtrace().
#endif
#if HAVE_SIGNAL_H
@@ -52,6 +52,7 @@
#include <unwind.h>
#else
#undef HAVE__UNWIND_BACKTRACE
+#undef HAVE_BACKTRACE
#endif
#endif
--- third_party/nasm/nasmlib/realpath.c.orig 2019-07-03 12:23:05.021949895 -0400
+++ third_party/nasm/nasmlib/realpath.c 2019-07-03 12:24:24.246862665 -0400
@@ -49,7 +49,7 @@
#include "nasmlib.h"
-#ifdef HAVE_CANONICALIZE_FILE_NAME
+#if defined(__GLIBC__)
/*
* GNU-specific, but avoids the realpath(..., NULL)
--- mojo/public/cpp/platform/named_platform_channel_posix.cc.orig 2020-07-19 13:26:10.696171063 -0400
+++ mojo/public/cpp/platform/named_platform_channel_posix.cc 2020-07-19 13:26:43.680151714 -0400
@@ -5,6 +5,7 @@
#include "mojo/public/cpp/platform/named_platform_channel.h"
#include <errno.h>
+#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
--- third_party/perfetto/include/perfetto/ext/base/thread_utils.h
+++ third_party/perfetto/include/perfetto/ext/base/thread_utils.h
@@ -29,7 +29,7 @@
#include <algorithm>
#endif
-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+#if 1
#include <sys/prctl.h>
#endif
@@ -58,7 +58,7 @@ inline bool MaybeSetThreadName(const std::string& name) {
inline bool GetThreadName(std::string& out_result) {
char buf[16] = {};
-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+#if 1
if (prctl(PR_GET_NAME, buf) != 0)
return false;
#else