sys-libs/compiler-rt-sanitizers: Rebase patches for -9999
authorMichał Górny <mgorny@gentoo.org>
Tue, 30 Oct 2018 09:02:38 +0000 (10:02 +0100)
committerMichał Górny <mgorny@gentoo.org>
Tue, 30 Oct 2018 09:02:38 +0000 (10:02 +0100)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0.ebuild
sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.9999.ebuild
sys-libs/compiler-rt-sanitizers/files/7.0.9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch [new file with mode: 0644]
sys-libs/compiler-rt-sanitizers/files/7.0.9999/0002-test-Support-using-libtirpc-on-Linux.patch [new file with mode: 0644]
sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
sys-libs/compiler-rt-sanitizers/files/9999/0002-test-Support-using-libtirpc-on-Linux.patch

index b4dec8cc00b0276e1235b7dce67ab109392822f7..97f45a06894f1f9f81f83f93284c635cdd3d5795 100644 (file)
@@ -76,8 +76,8 @@ src_prepare() {
        cmake-utils_src_prepare
 
        # apply the fixes for new glibc / split tirpc
-       eapply "${FILESDIR}/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
-       eapply "${FILESDIR}/9999/0002-test-Support-using-libtirpc-on-Linux.patch"
+       eapply "${FILESDIR}/7.0.9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
+       eapply "${FILESDIR}/7.0.9999/0002-test-Support-using-libtirpc-on-Linux.patch"
 
        if use test; then
                # remove tests that are (still) broken by new glibc
index d68ca7b8bdfb6d0490b410112356fde309177482..a71b3be6becb42f9d9769dad62799683a42588c0 100644 (file)
@@ -77,8 +77,8 @@ src_prepare() {
        cmake-utils_src_prepare
 
        # apply the fixes for new glibc / split tirpc
-       eapply "${FILESDIR}/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
-       eapply "${FILESDIR}/9999/0002-test-Support-using-libtirpc-on-Linux.patch"
+       eapply "${FILESDIR}/7.0.9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
+       eapply "${FILESDIR}/7.0.9999/0002-test-Support-using-libtirpc-on-Linux.patch"
 
        if use test; then
                # remove tests that are (still) broken by new glibc
diff --git a/sys-libs/compiler-rt-sanitizers/files/7.0.9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/7.0.9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
new file mode 100644 (file)
index 0000000..ca871c3
--- /dev/null
@@ -0,0 +1,67 @@
+From e198d21b9a5851dbc061f60911e3b3da910bca0a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 6 Jun 2018 12:16:38 +0200
+Subject: [PATCH 7/8] [sanitizer_common] Fix using libtirpc on Linux
+
+Fix using libtirpc on Linux by using pkg-config to detect it, and append
+appropriate include directory.  The libtirpc headers reference one
+another via '#include <rpc/...>', so attempting to include it via
+'#include <tirpc/...>' just failed and resulted in RPC headers not being
+detected at all.
+
+Additionally, perform the header check without -nodefaultlibs as that
+apparently causes it to fail.
+---
+ lib/sanitizer_common/CMakeLists.txt                   | 11 ++++++++++-
+ .../sanitizer_platform_limits_posix.cc                |  4 +---
+ 2 files changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
+index e0226ae49..4071bc0e8 100644
+--- a/lib/sanitizer_common/CMakeLists.txt
++++ b/lib/sanitizer_common/CMakeLists.txt
+@@ -151,9 +151,18 @@ include_directories(..)
+ 
+ set(SANITIZER_COMMON_DEFINITIONS)
+ 
++include(FindPkgConfig)
++pkg_check_modules(TIRPC libtirpc)
++if (TIRPC_FOUND)
++  include_directories(${TIRPC_INCLUDE_DIRS})
++  set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS})
++endif()
++
+ include(CheckIncludeFile)
++cmake_push_check_state()
++string(REPLACE "-nodefaultlibs" "" CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ append_have_file_definition(rpc/xdr.h HAVE_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
+-append_have_file_definition(tirpc/rpc/xdr.h HAVE_TIRPC_RPC_XDR_H SANITIZER_COMMON_DEFINITIONS)
++cmake_pop_check_state()
+ 
+ set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
+ append_rtti_flag(OFF SANITIZER_CFLAGS)
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+index feb7bad6f..2e736ee26 100644
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -146,8 +146,6 @@ typedef struct user_fpregs elf_fpregset_t;
+ #include <netrom/netrom.h>
+ #if HAVE_RPC_XDR_H
+ # include <rpc/xdr.h>
+-#elif HAVE_TIRPC_RPC_XDR_H
+-# include <tirpc/rpc/xdr.h>
+ #endif
+ #include <scsi/scsi.h>
+ #include <sys/mtio.h>
+@@ -1236,7 +1234,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
+ CHECK_SIZE_AND_OFFSET(group, gr_gid);
+ CHECK_SIZE_AND_OFFSET(group, gr_mem);
+ 
+-#if HAVE_RPC_XDR_H || HAVE_TIRPC_RPC_XDR_H
++#if HAVE_RPC_XDR_H
+ CHECK_TYPE_SIZE(XDR);
+ CHECK_SIZE_AND_OFFSET(XDR, x_op);
+ CHECK_SIZE_AND_OFFSET(XDR, x_ops);
+-- 
+2.18.0
+
diff --git a/sys-libs/compiler-rt-sanitizers/files/7.0.9999/0002-test-Support-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/7.0.9999/0002-test-Support-using-libtirpc-on-Linux.patch
new file mode 100644 (file)
index 0000000..8802847
--- /dev/null
@@ -0,0 +1,100 @@
+From 4fc99ef388e2f110759dc774428fd194b65614c8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 6 Jun 2018 12:45:55 +0200
+Subject: [PATCH 8/8] [test] Support using libtirpc on Linux
+
+Add compiler flags necessary for using libtirpc on Linux (RPC headers
+split out of glibc).  The flags are obtained via pkg-config.  This fixes
+test failures due to tests being unable to find <rpc/...> includes.
+---
+ cmake/base-config-ix.cmake          | 4 ++++
+ lib/sanitizer_common/CMakeLists.txt | 2 --
+ test/msan/lit.cfg                   | 3 ++-
+ test/msan/lit.site.cfg.in           | 1 +
+ test/tsan/lit.cfg                   | 3 ++-
+ test/tsan/lit.site.cfg.in           | 1 +
+ 6 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index b208f0852..46b88f72b 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -8,6 +8,10 @@ include(CheckCXXSourceCompiles)
+ 
+ check_include_file(unwind.h HAVE_UNWIND_H)
+ 
++# used in sanitizer_common and tests
++include(FindPkgConfig)
++pkg_check_modules(TIRPC libtirpc)
++
+ # Top level target used to build all compiler-rt libraries.
+ add_custom_target(compiler-rt ALL)
+ add_custom_target(install-compiler-rt)
+diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
+index 4071bc0e8..08d1781a6 100644
+--- a/lib/sanitizer_common/CMakeLists.txt
++++ b/lib/sanitizer_common/CMakeLists.txt
+@@ -151,8 +151,6 @@ include_directories(..)
+ 
+ set(SANITIZER_COMMON_DEFINITIONS)
+ 
+-include(FindPkgConfig)
+-pkg_check_modules(TIRPC libtirpc)
+ if (TIRPC_FOUND)
+   include_directories(${TIRPC_INCLUDE_DIRS})
+   set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS})
+diff --git a/test/msan/lit.cfg b/test/msan/lit.cfg
+index cac260999..fe8525047 100644
+--- a/test/msan/lit.cfg
++++ b/test/msan/lit.cfg
+@@ -14,7 +14,8 @@ clang_msan_cflags = (["-fsanitize=memory",
+                       "-fno-omit-frame-pointer",
+                       "-fno-optimize-sibling-calls"] +
+                       [config.target_cflags] +
+-                      config.debug_info_flags)
++                      config.debug_info_flags +
++                      [config.rpc_cflags])
+ # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
+ if config.host_os == 'FreeBSD':
+   clang_msan_cflags += ["-lexecinfo"]
+diff --git a/test/msan/lit.site.cfg.in b/test/msan/lit.site.cfg.in
+index f744d71fd..35634d324 100644
+--- a/test/msan/lit.site.cfg.in
++++ b/test/msan/lit.site.cfg.in
+@@ -6,6 +6,7 @@ config.target_cflags = "@MSAN_TEST_TARGET_CFLAGS@"
+ config.target_arch = "@MSAN_TEST_TARGET_ARCH@"
+ config.use_lld = @MSAN_TEST_USE_LLD@
+ config.use_thinlto = @MSAN_TEST_USE_THINLTO@
++config.rpc_cflags = "@TIRPC_CFLAGS@"
+ 
+ # Load common config for all compiler-rt lit tests.
+ lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
+diff --git a/test/tsan/lit.cfg b/test/tsan/lit.cfg
+index fdbafefbc..82fd2f79d 100644
+--- a/test/tsan/lit.cfg
++++ b/test/tsan/lit.cfg
+@@ -49,7 +49,8 @@ clang_tsan_cflags = (["-fsanitize=thread",
+                       [config.target_cflags] +
+                       config.debug_info_flags +
+                       extra_cflags +
+-                      ["-I%s" % tsan_incdir])
++                      ["-I%s" % tsan_incdir] +
++                      [config.rpc_cflags])
+ clang_tsan_cxxflags = config.cxx_mode_flags + clang_tsan_cflags + ["-std=c++11"] + ["-I%s" % tsan_incdir]
+ # Add additional flags if we're using instrumented libc++.
+ # Instrumented libcxx currently not supported on Darwin.
+diff --git a/test/tsan/lit.site.cfg.in b/test/tsan/lit.site.cfg.in
+index a215e664a..142d61bf2 100644
+--- a/test/tsan/lit.site.cfg.in
++++ b/test/tsan/lit.site.cfg.in
+@@ -7,6 +7,7 @@ config.ios = @TSAN_TEST_IOS_PYBOOL@
+ config.iossim = @TSAN_TEST_IOSSIM_PYBOOL@
+ config.target_cflags = "@TSAN_TEST_TARGET_CFLAGS@"
+ config.target_arch = "@TSAN_TEST_TARGET_ARCH@"
++config.rpc_cflags = "@TIRPC_CFLAGS@"
+ 
+ # Load common config for all compiler-rt lit tests.
+ lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
+-- 
+2.18.0
+
index ca871c37b994a2d3e28904fd7fa23c2fc22ffb68..f39645669da088b00b336bea7b4c0a772e92fadb 100644 (file)
@@ -1,7 +1,7 @@
-From e198d21b9a5851dbc061f60911e3b3da910bca0a Mon Sep 17 00:00:00 2001
+From 6d96ca43ca31bb69d07271696c43b4372ca534d9 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
 Date: Wed, 6 Jun 2018 12:16:38 +0200
-Subject: [PATCH 7/8] [sanitizer_common] Fix using libtirpc on Linux
+Subject: [PATCH 1/2] [sanitizer_common] Fix using libtirpc on Linux
 
 Fix using libtirpc on Linux by using pkg-config to detect it, and append
 appropriate include directory.  The libtirpc headers reference one
@@ -17,10 +17,10 @@ apparently causes it to fail.
  2 files changed, 11 insertions(+), 4 deletions(-)
 
 diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
-index e0226ae49..4071bc0e8 100644
+index ad3aba005..f2a6bab51 100644
 --- a/lib/sanitizer_common/CMakeLists.txt
 +++ b/lib/sanitizer_common/CMakeLists.txt
-@@ -151,9 +151,18 @@ include_directories(..)
+@@ -191,9 +191,18 @@ include_directories(..)
  
  set(SANITIZER_COMMON_DEFINITIONS)
  
@@ -41,7 +41,7 @@ index e0226ae49..4071bc0e8 100644
  set(SANITIZER_CFLAGS ${SANITIZER_COMMON_CFLAGS})
  append_rtti_flag(OFF SANITIZER_CFLAGS)
 diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
-index feb7bad6f..2e736ee26 100644
+index cd1b73d58..c6de2683d 100644
 --- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
 +++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
 @@ -146,8 +146,6 @@ typedef struct user_fpregs elf_fpregset_t;
@@ -53,7 +53,7 @@ index feb7bad6f..2e736ee26 100644
  #endif
  #include <scsi/scsi.h>
  #include <sys/mtio.h>
-@@ -1236,7 +1234,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
+@@ -1243,7 +1241,7 @@ CHECK_SIZE_AND_OFFSET(group, gr_passwd);
  CHECK_SIZE_AND_OFFSET(group, gr_gid);
  CHECK_SIZE_AND_OFFSET(group, gr_mem);
  
@@ -63,5 +63,5 @@ index feb7bad6f..2e736ee26 100644
  CHECK_SIZE_AND_OFFSET(XDR, x_op);
  CHECK_SIZE_AND_OFFSET(XDR, x_ops);
 -- 
-2.18.0
+2.19.1
 
index 880284775e22d827b40f2f4a08d1f65fcf383b4a..c851cae0a6b8b688f348cceb71dc39d8103f9c1b 100644 (file)
@@ -1,7 +1,7 @@
-From 4fc99ef388e2f110759dc774428fd194b65614c8 Mon Sep 17 00:00:00 2001
+From a415328c75fe88c5e8e3bd0c01913a25b5705fec Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
 Date: Wed, 6 Jun 2018 12:45:55 +0200
-Subject: [PATCH 8/8] [test] Support using libtirpc on Linux
+Subject: [PATCH 2/2] [test] Support using libtirpc on Linux
 
 Add compiler flags necessary for using libtirpc on Linux (RPC headers
 split out of glibc).  The flags are obtained via pkg-config.  This fixes
@@ -16,7 +16,7 @@ test failures due to tests being unable to find <rpc/...> includes.
  6 files changed, 10 insertions(+), 4 deletions(-)
 
 diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
-index b208f0852..46b88f72b 100644
+index b92e29a2e..ec0b1b979 100644
 --- a/cmake/base-config-ix.cmake
 +++ b/cmake/base-config-ix.cmake
 @@ -8,6 +8,10 @@ include(CheckCXXSourceCompiles)
@@ -31,10 +31,10 @@ index b208f0852..46b88f72b 100644
  add_custom_target(compiler-rt ALL)
  add_custom_target(install-compiler-rt)
 diff --git a/lib/sanitizer_common/CMakeLists.txt b/lib/sanitizer_common/CMakeLists.txt
-index 4071bc0e8..08d1781a6 100644
+index f2a6bab51..a560e7c15 100644
 --- a/lib/sanitizer_common/CMakeLists.txt
 +++ b/lib/sanitizer_common/CMakeLists.txt
-@@ -151,8 +151,6 @@ include_directories(..)
+@@ -191,8 +191,6 @@ include_directories(..)
  
  set(SANITIZER_COMMON_DEFINITIONS)
  
@@ -44,7 +44,7 @@ index 4071bc0e8..08d1781a6 100644
    include_directories(${TIRPC_INCLUDE_DIRS})
    set(CMAKE_REQUIRED_INCLUDES ${TIRPC_INCLUDE_DIRS})
 diff --git a/test/msan/lit.cfg b/test/msan/lit.cfg
-index cac260999..fe8525047 100644
+index e08673d5c..e86f6091f 100644
 --- a/test/msan/lit.cfg
 +++ b/test/msan/lit.cfg
 @@ -14,7 +14,8 @@ clang_msan_cflags = (["-fsanitize=memory",
@@ -56,7 +56,7 @@ index cac260999..fe8525047 100644
 +                      [config.rpc_cflags])
  # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
  if config.host_os == 'FreeBSD':
-   clang_msan_cflags += ["-lexecinfo"]
+   clang_msan_cflags += ["-lexecinfo", "-fPIC"]
 diff --git a/test/msan/lit.site.cfg.in b/test/msan/lit.site.cfg.in
 index f744d71fd..35634d324 100644
 --- a/test/msan/lit.site.cfg.in
@@ -70,7 +70,7 @@ index f744d71fd..35634d324 100644
  # Load common config for all compiler-rt lit tests.
  lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
 diff --git a/test/tsan/lit.cfg b/test/tsan/lit.cfg
-index fdbafefbc..82fd2f79d 100644
+index 233d273f3..2776775eb 100644
 --- a/test/tsan/lit.cfg
 +++ b/test/tsan/lit.cfg
 @@ -49,7 +49,8 @@ clang_tsan_cflags = (["-fsanitize=thread",
@@ -84,11 +84,11 @@ index fdbafefbc..82fd2f79d 100644
  # Add additional flags if we're using instrumented libc++.
  # Instrumented libcxx currently not supported on Darwin.
 diff --git a/test/tsan/lit.site.cfg.in b/test/tsan/lit.site.cfg.in
-index a215e664a..142d61bf2 100644
+index 6dec5f92b..67020f3b9 100644
 --- a/test/tsan/lit.site.cfg.in
 +++ b/test/tsan/lit.site.cfg.in
-@@ -7,6 +7,7 @@ config.ios = @TSAN_TEST_IOS_PYBOOL@
- config.iossim = @TSAN_TEST_IOSSIM_PYBOOL@
+@@ -6,6 +6,7 @@ config.has_libcxx = @TSAN_HAS_LIBCXX@
+ config.apple_platform = "@TSAN_TEST_APPLE_PLATFORM@"
  config.target_cflags = "@TSAN_TEST_TARGET_CFLAGS@"
  config.target_arch = "@TSAN_TEST_TARGET_ARCH@"
 +config.rpc_cflags = "@TIRPC_CFLAGS@"
@@ -96,5 +96,5 @@ index a215e664a..142d61bf2 100644
  # Load common config for all compiler-rt lit tests.
  lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
 -- 
-2.18.0
+2.19.1