diff options
author | Michał Górny <mgorny@gentoo.org> | 2019-10-20 22:46:34 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2019-10-20 23:10:28 +0200 |
commit | 8f49ee2a7f534503415b56cf67babc40598bf2ba (patch) | |
tree | 163a5863c801167a6b52da34f86668da6f925307 /sys-libs/compiler-rt | |
parent | gnome-extra/gnome-clocks: bump to 3.32.0 (diff) | |
download | gentoo-8f49ee2a7f534503415b56cf67babc40598bf2ba.tar.gz gentoo-8f49ee2a7f534503415b56cf67babc40598bf2ba.tar.bz2 gentoo-8f49ee2a7f534503415b56cf67babc40598bf2ba.zip |
sys-libs/compiler-rt: Backport crt*.o fix
Closes: https://bugs.gentoo.org/698086
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'sys-libs/compiler-rt')
-rw-r--r-- | sys-libs/compiler-rt/compiler-rt-9.0.0-r1.ebuild (renamed from sys-libs/compiler-rt/compiler-rt-9.0.0.ebuild) | 6 | ||||
-rw-r--r-- | sys-libs/compiler-rt/files/9.0.0/0001-compiler-rt-crt-make-test-case-nontrivial-in-check_c.patch | 41 |
2 files changed, 47 insertions, 0 deletions
diff --git a/sys-libs/compiler-rt/compiler-rt-9.0.0.ebuild b/sys-libs/compiler-rt/compiler-rt-9.0.0-r1.ebuild index bfb57a667381..d371193d71d4 100644 --- a/sys-libs/compiler-rt/compiler-rt-9.0.0.ebuild +++ b/sys-libs/compiler-rt/compiler-rt-9.0.0-r1.ebuild @@ -37,6 +37,12 @@ BDEPEND=" # least intrusive of all CMAKE_BUILD_TYPE=RelWithDebInfo +PATCHES=( + # Fix building broken crtbegin/crtend + # https://bugs.gentoo.org/698086 + "${FILESDIR}"/9.0.0/0001-compiler-rt-crt-make-test-case-nontrivial-in-check_c.patch +) + pkg_pretend() { if ! use clang && ! tc-is-clang; then ewarn "Building using a compiler other than clang may result in broken atomics" diff --git a/sys-libs/compiler-rt/files/9.0.0/0001-compiler-rt-crt-make-test-case-nontrivial-in-check_c.patch b/sys-libs/compiler-rt/files/9.0.0/0001-compiler-rt-crt-make-test-case-nontrivial-in-check_c.patch new file mode 100644 index 000000000000..ccae96cad98a --- /dev/null +++ b/sys-libs/compiler-rt/files/9.0.0/0001-compiler-rt-crt-make-test-case-nontrivial-in-check_c.patch @@ -0,0 +1,41 @@ +From 155a43edb0c161bb5122ad4eeee991b43a0278bc Mon Sep 17 00:00:00 2001 +From: Jian Cai <caij2003@gmail.com> +Date: Mon, 16 Sep 2019 21:47:47 +0000 +Subject: [PATCH] [compiler-rt][crt] make test case nontrivial in + check_cxx_section_exists + +Summary: +.init_array gets optimized away when building with -O2 and as a result, +check_cxx_section_exists failed to pass -DCOMPILER_RT_HAS_INITFINI_ARRAY +when building crtbegin.o and crtend.o, which causes binaries linked with +them encounter segmentation fault. See https://crbug.com/855759 for +details. This change prevents .init_array section to be optimized away +even with -O2 or higher optimization level. + +Subscribers: dberris, mgorny, #sanitizers, llvm-commits + +Tags: #sanitizers, #llvm + +Differential Revision: https://reviews.llvm.org/D67628 + +llvm-svn: 372038 +--- + lib/crt/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/crt/CMakeLists.txt b/lib/crt/CMakeLists.txt +index 34c368f7ca4..90e94b93db4 100644 +--- a/lib/crt/CMakeLists.txt ++++ b/lib/crt/CMakeLists.txt +@@ -70,7 +70,7 @@ function(check_cxx_section_exists section output) + endfunction() + + check_cxx_section_exists(".init_array" COMPILER_RT_HAS_INITFINI_ARRAY +- SOURCE "__attribute__((constructor)) void f() {}\nint main() { return 0; }\n") ++ SOURCE "volatile int x;\n__attribute__((constructor)) void f() {x = 0;}\nint main() { return 0; }\n") + + append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 CRT_CFLAGS) + append_list_if(COMPILER_RT_HAS_INITFINI_ARRAY -DCRT_HAS_INITFINI_ARRAY CRT_CFLAGS) +-- +2.23.0 + |