public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-libs/compiler-rt-sanitizers/, sys-libs/compiler-rt-sanitizers/files/9999/
@ 2018-09-05  6:20 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2018-09-05  6:20 UTC (permalink / raw
  To: gentoo-commits

commit:     a24ec3238f68cc33307abf658b7a1d08e4ffc480
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  5 06:06:11 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep  5 06:20:12 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a24ec323

sys-libs/compiler-rt-sanitizers: Inline new glibc patches

Inline the patches needed for new glibc (with split tirpc) since they
have not been merged upstream, and are appropriately needed for -9999
as well.

 .../compiler-rt-sanitizers-7.0.0_rc2.ebuild        |  11 +--
 ...itizer_common-Fix-using-libtirpc-on-Linux.patch |  67 ++++++++++++++
 ...0002-test-Support-using-libtirpc-on-Linux.patch | 100 +++++++++++++++++++++
 3 files changed, 171 insertions(+), 7 deletions(-)

diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild
index f606ef2f383..07047f9ba30 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-7.0.0_rc2.ebuild
@@ -17,7 +17,6 @@ LLVM_P=llvm-${PV/_/}.src
 DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
 HOMEPAGE="https://llvm.org/"
 SRC_URI="https://prereleases.llvm.org/${PV/_//}/${MY_P}.tar.xz
-	https://dev.gentoo.org/~mgorny/dist/llvm/${PN}-6.0.1-patchset.tar.xz
 	test? ( https://releases.llvm.org/${PV/_//}/${LLVM_P}.tar.xz )"
 
 LICENSE="|| ( UoI-NCSA MIT )"
@@ -63,8 +62,6 @@ pkg_setup() {
 src_unpack() {
 	einfo "Unpacking ${MY_P}.tar.xz ..."
 	tar -xf "${DISTDIR}/${MY_P}.tar.xz" || die
-	einfo "Unpacking ${P}-patchset.tar.xz ..."
-	tar -xf "${DISTDIR}/${PN}-6.0.1-patchset.tar.xz" || die
 
 	if use test; then
 		einfo "Unpacking parts of ${LLVM_P}.tar.xz ..."
@@ -77,12 +74,12 @@ src_unpack() {
 src_prepare() {
 	cmake-utils_src_prepare
 
-	# apply the patchset (new glibc fixes)
-	eapply "${WORKDIR}/${PN}-6.0.1-patchset/0007-sanitizer_common-Fix-using-libtirpc-on-Linux.patch"
-	eapply "${WORKDIR}/${PN}-6.0.1-patchset/0008-test-Support-using-libtirpc-on-Linux.patch"
+	# 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"
 
 	if use test; then
-		# remove tests that are broken by new glibc
+		# remove tests that are (still) broken by new glibc
 		# https://bugs.llvm.org/show_bug.cgi?id=36065
 		if use elibc_glibc && has_version '>=sys-libs/glibc-2.25'; then
 			rm test/lsan/TestCases/Linux/use_tls_dynamic.cc || die

diff --git a/sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
new file mode 100644
index 00000000000..ca871c37b99
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/files/9999/0001-sanitizer_common-Fix-using-libtirpc-on-Linux.patch
@@ -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/9999/0002-test-Support-using-libtirpc-on-Linux.patch b/sys-libs/compiler-rt-sanitizers/files/9999/0002-test-Support-using-libtirpc-on-Linux.patch
new file mode 100644
index 00000000000..880284775e2
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/files/9999/0002-test-Support-using-libtirpc-on-Linux.patch
@@ -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
+


^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-libs/compiler-rt-sanitizers/, sys-libs/compiler-rt-sanitizers/files/9999/
@ 2020-12-27  9:50 Fabian Groffen
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Groffen @ 2020-12-27  9:50 UTC (permalink / raw
  To: gentoo-commits

commit:     597a22dec78d405170e09ec9f971d5146e0bfadf
Author:     Jacob Floyd <cognifloyd <AT> gmail <DOT> com>
AuthorDate: Sun Dec 20 22:03:21 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec 27 09:49:33 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=597a22de

sys-libs/compiler-rt-sanitizers: Fix Darwin prefix paths

Gentoo Prefix does not follow standard Apple practice of using --sysroot
or --isysroot on everything because we have to account for two "root"s.
1) EPREFIX is "root"
2) EPREFIX/MacOSX.sdk is also sysroot as it provides system headers.

So, adjust sys-libs/compiler-rt-sanitizers to prevent them from adding
the sysroot flags on Darwin.

Also adjust some CMAKE args to ensure it is using EPREFIX/MacOSX.sdk
instead of looking things up with xcrun.

Bug: https://bugs.gentoo.org/758167
Signed-off-by: Jacob Floyd <cognifloyd <AT> gmail.com>
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../compiler-rt-sanitizers-11.0.0.ebuild           | 15 +++-
 .../compiler-rt-sanitizers-11.0.1.9999.ebuild      | 15 +++-
 .../compiler-rt-sanitizers-11.0.1_rc1.ebuild       | 15 +++-
 .../compiler-rt-sanitizers-11.0.1_rc2.ebuild       | 15 +++-
 .../compiler-rt-sanitizers-12.0.0.9999.ebuild      | 15 +++-
 .../files/9999/compiler-rt-prefix-paths.patch      | 79 ++++++++++++++++++++++
 6 files changed, 144 insertions(+), 10 deletions(-)

diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild
index 24deafb6666..f767718861c 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild
@@ -35,6 +35,10 @@ BDEPEND="
 		sys-libs/compiler-rt:${SLOT} )
 	${PYTHON_DEPS}"
 
+PATCHES=(
+	"${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
 python_check_deps() {
 	use test || return 0
 	has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -110,8 +114,15 @@ src_configure() {
 
 	if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
 		mycmakeargs+=(
-			# disable use of SDK for the system itself
-			-DDARWIN_macosx_CACHED_SYSROOT=/
+			# setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+			# this allows adding arm64 support using SDK in EPREFIX
+			-DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+			# Set version based on the SDK in EPREFIX
+			# This disables i386 for SDK >= 10.15
+			# Will error while building tsan if SDK < 10.12
+			-DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+			# Use our libtool instead of looking it up with xcrun
+			-DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
 		)
 	fi
 

diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild
index 81547ee1605..14dbd46a8db 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt )
 LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
 llvm.org_set_globals
 
+PATCHES=(
+	"${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
 python_check_deps() {
 	use test || return 0
 	has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -145,8 +149,15 @@ src_configure() {
 
 	if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
 		mycmakeargs+=(
-			# disable use of SDK for the system itself
-			-DDARWIN_macosx_CACHED_SYSROOT=/
+			# setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+			# this allows adding arm64 support using SDK in EPREFIX
+			-DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+			# Set version based on the SDK in EPREFIX
+			# This disables i386 for SDK >= 10.15
+			# Will error if has_use tsan and SDK < 10.12
+			-DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+			# Use our libtool instead of looking it up with xcrun
+			-DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
 		)
 	fi
 

diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild
index 1e3a849c675..cc4d0af346b 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild
@@ -37,6 +37,10 @@ LLVM_COMPONENTS=( compiler-rt )
 LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
 llvm.org_set_globals
 
+PATCHES=(
+	"${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
 python_check_deps() {
 	use test || return 0
 	has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -112,8 +116,15 @@ src_configure() {
 
 	if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
 		mycmakeargs+=(
-			# disable use of SDK for the system itself
-			-DDARWIN_macosx_CACHED_SYSROOT=/
+			# setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+			# this allows adding arm64 support using SDK in EPREFIX
+			-DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+			# Set version based on the SDK in EPREFIX
+			# This disables i386 for SDK >= 10.15
+			# Will error if has_use tsan and SDK < 10.12
+			-DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+			# Use our libtool instead of looking it up with xcrun
+			-DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
 		)
 	fi
 

diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild
index f5ea6f732f7..938e4e371e8 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt )
 LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
 llvm.org_set_globals
 
+PATCHES=(
+	"${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
 python_check_deps() {
 	use test || return 0
 	has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -149,8 +153,15 @@ src_configure() {
 
 	if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
 		mycmakeargs+=(
-			# disable use of SDK for the system itself
-			-DDARWIN_macosx_CACHED_SYSROOT=/
+			# setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+			# this allows adding arm64 support using SDK in EPREFIX
+			-DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+			# Set version based on the SDK in EPREFIX
+			# This disables i386 for SDK >= 10.15
+			# Will error if has_use tsan and SDK < 10.12
+			-DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+			# Use our libtool instead of looking it up with xcrun
+			-DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
 		)
 	fi
 

diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild
index 81547ee1605..14dbd46a8db 100644
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt )
 LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
 llvm.org_set_globals
 
+PATCHES=(
+	"${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
 python_check_deps() {
 	use test || return 0
 	has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -145,8 +149,15 @@ src_configure() {
 
 	if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
 		mycmakeargs+=(
-			# disable use of SDK for the system itself
-			-DDARWIN_macosx_CACHED_SYSROOT=/
+			# setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+			# this allows adding arm64 support using SDK in EPREFIX
+			-DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+			# Set version based on the SDK in EPREFIX
+			# This disables i386 for SDK >= 10.15
+			# Will error if has_use tsan and SDK < 10.12
+			-DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+			# Use our libtool instead of looking it up with xcrun
+			-DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
 		)
 	fi
 

diff --git a/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch
new file mode 100644
index 00000000000..c27e3c44f68
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch
@@ -0,0 +1,79 @@
+--- a/compiler-rt/cmake/config-ix.cmake	2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/config-ix.cmake	2020-12-13 16:17:43.000000000 -0600
+@@ -424,10 +424,7 @@
+     ${DARWIN_COMMON_LINK_FLAGS}
+     ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION})
+ 
+-  if(DARWIN_osx_SYSROOT)
+-    list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
+-    list(APPEND DARWIN_osx_LINK_FLAGS -isysroot ${DARWIN_osx_SYSROOT})
+-  endif()
++  # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
+ 
+   # Figure out which arches to use for each OS
+   darwin_get_toolchain_supported_archs(toolchain_arches)
+--- a/compiler-rt/cmake/base-config-ix.cmake	2020-12-13 16:17:13.000000000 -0600
++++ b/compiler-rt/cmake/base-config-ix.cmake	2020-12-13 16:18:59.000000000 -0600
+@@ -102,23 +102,8 @@
+ endif()
+ 
+ if(APPLE)
+-  # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but
+-  # not the command line tools (or is using macOS 10.14 or newer). If this is
+-  # the case, we need to find the OS X sysroot to pass to clang.
+-  if(NOT EXISTS /usr/include/c++)
+-    execute_process(COMMAND xcrun -sdk macosx --show-sdk-path
+-       OUTPUT_VARIABLE OSX_SYSROOT
+-       ERROR_QUIET
+-       OUTPUT_STRIP_TRAILING_WHITESPACE)
+-    if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT})
+-      message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist")
+-    else()
+-      message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}")
+-      set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
+-    endif()
+-  else()
+-    set(OSX_SYSROOT_FLAG "")
+-  endif()
++  # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
++  set(OSX_SYSROOT_FLAG "")
+ 
+   option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
+   option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
+--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake	2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake	2020-12-13 16:21:32.000000000 -0600
+@@ -273,7 +273,8 @@
+     ${ARGN})
+   set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}")
+   add_library(${libname} STATIC ${LIB_SOURCES})
+-  if(DARWIN_${LIB_OS}_SYSROOT)
++  # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
++  if(DARWIN_${LIB_OS}_SYSROOT AND NOT "${LIB_OS}" STREQUAL "osx")
+     set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
+   endif()
+
+--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake	2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake	2020-12-13 18:12:27.000000000 -0600
+@@ -277,9 +277,10 @@
+       if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
+         list(APPEND extra_cflags_${libname} "--target=${CMAKE_C_COMPILER_TARGET}")
+       endif()
++      # Do not add --sysroot flag on Gentoo Prefix (search paths handled by cmake)
+-      if(CMAKE_SYSROOT)
++      if(CMAKE_SYSROOT AND NOT APPLE)
+         list(APPEND extra_cflags_${libname} "--sysroot=${CMAKE_SYSROOT}")
+       endif()
+       string(REPLACE ";" " " extra_cflags_${libname} "${extra_cflags_${libname}}")
+       string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
+              ${CMAKE_C_COMPILE_OBJECT})
+--- a/compiler-rt/lib/tsan/CMakeLists.txt	2020-12-13 19:42:02.000000000 -0600
++++ b/compiler-rt/lib/tsan/CMakeLists.txt	2020-12-13 19:42:38.000000000 -0600
+@@ -244,6 +244,7 @@
+ # and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD/NetBSD
+ # until this is addressed.
+ if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
++   AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin"
+    AND NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+   file(GLOB _tsan_generic_sources rtl/tsan*)
+   file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
+


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-27  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-05  6:20 [gentoo-commits] repo/gentoo:master commit in: sys-libs/compiler-rt-sanitizers/, sys-libs/compiler-rt-sanitizers/files/9999/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2020-12-27  9:50 Fabian Groffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox