diff options
Diffstat (limited to 'sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-7.0.1-musl-patches.patch')
-rw-r--r-- | sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-7.0.1-musl-patches.patch | 289 |
1 files changed, 289 insertions, 0 deletions
diff --git a/sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-7.0.1-musl-patches.patch b/sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-7.0.1-musl-patches.patch new file mode 100644 index 0000000..4a1358f --- /dev/null +++ b/sys-libs/compiler-rt-sanitizers/files/compiler-rt-sanitizers-7.0.1-musl-patches.patch @@ -0,0 +1,289 @@ +diff -Naur compiler-rt-6.0.1.src.orig/lib/asan/asan_linux.cc compiler-rt-6.0.1.src/lib/asan/asan_linux.cc +--- compiler-rt-6.0.1.src.orig/lib/asan/asan_linux.cc 2018-02-07 11:51:13.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/asan/asan_linux.cc 2018-06-27 13:01:11.942744865 -0700 +@@ -46,7 +46,7 @@ + #include <link.h> + #endif + +-#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS ++#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU + #include <ucontext.h> + extern "C" void* _DYNAMIC; + #elif SANITIZER_NETBSD +@@ -139,7 +139,7 @@ + UNIMPLEMENTED(); + } + +-#if SANITIZER_ANDROID ++#if SANITIZER_ANDROID || SANITIZER_NONGNU + // FIXME: should we do anything for Android? + void AsanCheckDynamicRTPrereqs() {} + void AsanCheckIncompatibleRT() {} +diff -Naur compiler-rt-6.0.1.src.orig/lib/msan/msan_interceptors.cc compiler-rt-6.0.1.src/lib/msan/msan_interceptors.cc +--- compiler-rt-6.0.1.src.orig/lib/msan/msan_interceptors.cc 2017-12-13 17:20:16.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/msan/msan_interceptors.cc 2018-06-27 13:01:11.942744865 -0700 +@@ -1438,6 +1438,7 @@ + return cbdata->callback(info, size, cbdata->data); + } + ++/* does not compile with musl + INTERCEPTOR(void *, shmat, int shmid, const void *shmaddr, int shmflg) { + ENSURE_MSAN_INITED(); + void *p = REAL(shmat)(shmid, shmaddr, shmflg); +@@ -1450,6 +1451,7 @@ + } + return p; + } ++*/ + + INTERCEPTOR(int, dl_iterate_phdr, dl_iterate_phdr_cb callback, void *data) { + void *ctx; +@@ -1668,7 +1670,7 @@ + INTERCEPT_FUNCTION(pthread_join); + INTERCEPT_FUNCTION(tzset); + INTERCEPT_FUNCTION(__cxa_atexit); +- INTERCEPT_FUNCTION(shmat); ++ // INTERCEPT_FUNCTION(shmat); // does not compile with musl + INTERCEPT_FUNCTION(fork); + INTERCEPT_FUNCTION(openpty); + INTERCEPT_FUNCTION(forkpty); +diff -Naur compiler-rt-6.0.1.src.orig/lib/msan/msan_linux.cc compiler-rt-6.0.1.src/lib/msan/msan_linux.cc +--- compiler-rt-6.0.1.src.orig/lib/msan/msan_linux.cc 2017-11-07 15:51:22.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/msan/msan_linux.cc 2018-06-27 13:01:11.943744865 -0700 +@@ -13,7 +13,7 @@ + //===----------------------------------------------------------------------===// + + #include "sanitizer_common/sanitizer_platform.h" +-#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD ++#if SANITIZER_FREEBSD || SANITIZER_LINUX && !SANITIZER_NONGNU || SANITIZER_NETBSD + + #include "msan.h" + #include "msan_thread.h" +diff -Naur compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +--- compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2017-12-14 12:14:29.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc 2018-06-27 13:01:11.944744865 -0700 +@@ -102,7 +102,7 @@ + _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz); + #endif + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + // Conflicting request ids. + // _(CDROMAUDIOBUFSIZ, NONE, 0); + // _(SNDCTL_TMR_CONTINUE, NONE, 0); +@@ -363,7 +363,7 @@ + _(VT_WAITACTIVE, NONE, 0); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE + _(CYGETDEFTHRESH, WRITE, sizeof(int)); + _(CYGETDEFTIMEOUT, WRITE, sizeof(int)); +diff -Naur compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_common_syscalls.inc compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_common_syscalls.inc +--- compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_common_syscalls.inc 2016-06-24 16:09:44.000000000 -0700 ++++ compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_common_syscalls.inc 2018-06-27 13:01:11.945744865 -0700 +@@ -2038,7 +2038,7 @@ + } + } + +-#if !SANITIZER_ANDROID ++#if !SANITIZER_ANDROID && !SANITIZER_NONGNU + PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim, + void *old_rlim) { + if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz); +diff -Naur compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_platform.h compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_platform.h +--- compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_platform.h 2017-12-14 12:14:29.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_platform.h 2018-06-27 13:01:11.945744865 -0700 +@@ -25,6 +25,12 @@ + # define SANITIZER_LINUX 0 + #endif + ++#if defined(__linux__) && !defined(__GLIBC__) ++# define SANITIZER_NONGNU 1 ++#else ++# define SANITIZER_NONGNU 0 ++#endif ++ + #if defined(__FreeBSD__) + # define SANITIZER_FREEBSD 1 + #else +diff -Naur compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_platform_interceptors.h compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_platform_interceptors.h +--- compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_platform_interceptors.h 2017-12-28 15:06:51.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_platform_interceptors.h 2018-06-27 13:01:11.945744865 -0700 +@@ -38,7 +38,7 @@ + # include "sanitizer_platform_limits_solaris.h" + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + # define SI_LINUX_NOT_ANDROID 1 + #else + # define SI_LINUX_NOT_ANDROID 0 +diff -Naur compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_platform_limits_posix.cc compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc +--- compiler-rt-6.0.1.src.orig/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-06-14 15:33:33.000000000 -0700 ++++ compiler-rt-6.0.1.src/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 2018-06-27 13:03:17.471742617 -0700 +@@ -138,12 +138,14 @@ + + #if SANITIZER_LINUX && !SANITIZER_ANDROID + #include <glob.h> +-#include <obstack.h> ++#if !SANITIZER_NONGNU ++# include <obstack.h> ++#endif + #include <mqueue.h> +-#include <net/if_ppp.h> +-#include <netax25/ax25.h> +-#include <netipx/ipx.h> +-#include <netrom/netrom.h> ++#include <linux/if_ppp.h> ++#include <linux/ax25.h> ++#include <linux/ipx.h> ++#include <linux/netrom.h> + #if HAVE_RPC_XDR_H + # include <rpc/xdr.h> + #elif HAVE_TIRPC_RPC_XDR_H +@@ -251,7 +253,7 @@ + unsigned struct_itimerspec_sz = sizeof(struct itimerspec); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which + // has been removed from glibc 2.28. + #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \ +@@ -286,9 +288,9 @@ + #endif + + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX && !SANITIZER_NONGNU || SANITIZER_FREEBSD) && !SANITIZER_ANDROID + unsigned struct_shminfo_sz = sizeof(struct shminfo); +- unsigned struct_shm_info_sz = sizeof(struct shm_info); ++ unsigned struct_shm_info_sz = sizeof(nstruct shm_info); + int shmctl_ipc_stat = (int)IPC_STAT; + int shmctl_ipc_info = (int)IPC_INFO; + int shmctl_shm_info = (int)SHM_INFO; +@@ -322,7 +324,7 @@ + unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr); + #endif + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + int glob_nomatch = GLOB_NOMATCH; + int glob_altdirfunc = GLOB_ALTDIRFUNC; + #endif +@@ -416,7 +418,7 @@ + unsigned struct_termios_sz = sizeof(struct termios); + unsigned struct_winsize_sz = sizeof(struct winsize); + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + unsigned struct_arpreq_sz = sizeof(struct arpreq); + unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf); + unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession); +@@ -466,7 +468,7 @@ + unsigned struct_vt_mode_sz = sizeof(struct vt_mode); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct); + unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor); + #if EV_VERSION > (0x010000) +@@ -834,7 +836,7 @@ + unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE; + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH; + unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT; + unsigned IOCTL_CYGETMON = CYGETMON; +@@ -989,7 +991,7 @@ + CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum); + #endif // SANITIZER_LINUX || SANITIZER_FREEBSD + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + CHECK_TYPE_SIZE(glob_t); + CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc); + CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv); +@@ -1023,6 +1025,7 @@ + CHECK_SIZE_AND_OFFSET(iovec, iov_base); + CHECK_SIZE_AND_OFFSET(iovec, iov_len); + ++#if !SANITIZER_NONGNU + CHECK_TYPE_SIZE(msghdr); + CHECK_SIZE_AND_OFFSET(msghdr, msg_name); + CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen); +@@ -1036,6 +1039,7 @@ + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len); + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level); + CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); ++#endif + + COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent)); + CHECK_SIZE_AND_OFFSET(dirent, d_ino); +@@ -1138,7 +1142,7 @@ + + CHECK_TYPE_SIZE(ether_addr); + +-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID ++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU + CHECK_TYPE_SIZE(ipc_perm); + # if SANITIZER_FREEBSD + CHECK_SIZE_AND_OFFSET(ipc_perm, key); +@@ -1199,7 +1203,7 @@ + CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data); + #endif + +-#if SANITIZER_LINUX ++#if SANITIZER_LINUX && !SANITIZER_NONGNU + COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo)); + #endif + +@@ -1249,7 +1253,7 @@ + COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE)); + CHECK_SIZE_AND_OFFSET(FILE, _flags); + CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr); +@@ -1268,7 +1272,7 @@ + CHECK_SIZE_AND_OFFSET(FILE, _fileno); + #endif + +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk)); + CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit); + CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev); +diff -Naur compiler-rt-6.0.1.src.orig/lib/tsan/rtl/tsan_platform_linux.cc compiler-rt-6.0.1.src/lib/tsan/rtl/tsan_platform_linux.cc +--- compiler-rt-6.0.1.src.orig/lib/tsan/rtl/tsan_platform_linux.cc 2017-11-28 08:28:54.000000000 -0800 ++++ compiler-rt-6.0.1.src/lib/tsan/rtl/tsan_platform_linux.cc 2018-06-27 13:01:11.946744865 -0700 +@@ -285,7 +285,7 @@ + // This is required to properly "close" the fds, because we do not see internal + // closes within glibc. The code is a pure hack. + int ExtractResolvFDs(void *state, int *fds, int nfd) { +-#if SANITIZER_LINUX && !SANITIZER_ANDROID ++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU + int cnt = 0; + struct __res_state *statp = (struct __res_state*)state; + for (int i = 0; i < MAXNS && cnt < nfd; i++) { +diff -u compiler-rt-7.0.1.src/lib/interception/interception_linux.cc.orig compiler-rt-7.0.1.src/lib/interception/interception_linux.cc +--- compiler-rt-7.0.1.src/lib/interception/interception_linux.cc.orig 2019-02-22 18:28:16.723989219 +0100 ++++ compiler-rt-7.0.1.src/lib/interception/interception_linux.cc 2019-02-22 18:28:46.170253720 +0100 +@@ -42,8 +42,8 @@ + return real == wrapper; + } + +-// Android and Solaris do not have dlvsym +-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD ++// musl, Android, and Solaris do not have dlvsym ++#if defined(__GLIBC__) && !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD + void *GetFuncAddrVer(const char *func_name, const char *ver) { + return dlvsym(RTLD_NEXT, func_name, ver); + } |