import compiler-rt-12.0.0-2.module+el8.5.0+11188+97d2441b

This commit is contained in:
CentOS Sources 2021-06-23 19:28:43 +00:00 committed by Andrew Lukoshko
parent a52ab0caa3
commit 62fe3515e1
10 changed files with 323 additions and 50 deletions

View File

@ -1,2 +1,2 @@
be3e79fb93cd99135643a191f27c49449bf9c0ee SOURCES/compiler-rt-11.0.0.src.tar.xz
32fa4b0193960f05064f2ab31b5a89c7cf48a0b9 SOURCES/hans-gpg-key.asc
7b02a455fbc6fe395da8d5411072acc04d669d94 SOURCES/compiler-rt-12.0.0.src.tar.xz
b8d2648a01d36ed0186fd2c5af325fd28797f9a0 SOURCES/tstellar-gpg-key.asc

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/compiler-rt-11.0.0.src.tar.xz
SOURCES/hans-gpg-key.asc
SOURCES/compiler-rt-12.0.0.src.tar.xz
SOURCES/tstellar-gpg-key.asc

View File

@ -0,0 +1,43 @@
From 8247295860b69fd379e282c3e6315df9f700e4d8 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Thu, 25 Feb 2021 14:12:57 +0100
Subject: [PATCH][compiler-rt] Workaround libstdc++ limitation wrt. thread copy
---
compiler-rt/lib/fuzzer/FuzzerDefs.h | 6 ++++++
compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/fuzzer/FuzzerDefs.h b/compiler-rt/lib/fuzzer/FuzzerDefs.h
index 1a2752a..abfbb8d 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDefs.h
+++ b/compiler-rt/lib/fuzzer/FuzzerDefs.h
@@ -50,6 +50,12 @@ template<typename T>
template<class Other>
struct rebind { typedef fuzzer_allocator<Other> other; };
+
+ template< class U, class... Args >
+ void construct( U* p, Args&&... args ) {
+ std::allocator<T>::construct(p, std::forward<Args>(args)...);
+ }
+
};
template<typename T>
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 447cafc..2fce139 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -294,7 +294,7 @@ static int RunInMultipleProcesses(const Vector<std::string> &Args,
std::thread Pulse(PulseThread);
Pulse.detach();
for (unsigned i = 0; i < NumWorkers; i++)
- V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+ V.emplace_back(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors);
for (auto &T : V)
T.join();
return HasErrors ? 1 : 0;
--
1.8.3.1

View File

@ -1,28 +0,0 @@
diff -ru compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDefs.h compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDefs.h
--- compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDefs.h 2019-01-09 21:46:09.000000000 +0000
+++ compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDefs.h 2019-02-12 14:03:32.971147814 +0000
@@ -176,6 +176,12 @@
template<class Other>
struct rebind { typedef fuzzer_allocator<Other> other; };
+
+ template< class U, class... Args >
+ void construct( U* p, Args&&... args ) {
+ std::allocator<T>::construct(p, std::forward<Args>(args)...);
+ }
+
};
template<typename T>
diff -ru compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDriver.cpp compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDriver.cpp
--- compiler-rt-8.0.0rc1.src.orig/lib/fuzzer/FuzzerDriver.cpp 2019-01-15 22:12:51.000000000 +0000
+++ compiler-rt-8.0.0rc1.src/lib/fuzzer/FuzzerDriver.cpp 2019-02-12 13:05:15.965113872 +0000
@@ -252,7 +252,7 @@
std::thread Pulse(PulseThread);
Pulse.detach();
for (unsigned i = 0; i < NumWorkers; i++)
- V.push_back(std::thread(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors));
+ V.emplace_back(WorkerThread, std::ref(Cmd), &Counter, NumJobs, &HasErrors);
for (auto &T : V)
T.join();
return HasErrors ? 1 : 0;

View File

@ -0,0 +1,71 @@
From ffd0f69c375f12f081a1a5158a02a05000b7a93c Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka@google.com>
Date: Fri, 16 Apr 2021 09:50:24 -0700
Subject: [PATCH][compiler-rt] Sanitizer built against glibc 2.34 doesn't work
As mentioned in https://gcc.gnu.org/PR100114 , glibc starting with the
https://sourceware.org/git/?p=glibc.git;a=commit;h=6c57d320484988e87e446e2e60ce42816bf51d53
change doesn't define SIGSTKSZ and MINSIGSTKSZ macros to constants, but to sysconf function call.
sanitizer_posix_libcdep.cpp has
static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough.
which is generally fine, just means that when SIGSTKSZ is not a compile time constant will be initialized later.
The problem is that kAltStackSize is used in SetAlternateSignalStack which is called very early, from .preinit_array
initialization, i.e. far before file scope variables are constructed, which means it is not initialized and
mmapping 0 will fail:
==145==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)
Here is one possible fix, another one could be to make kAltStackSize a preprocessor macro if _SG_SIGSTKSZ is defined
(but perhaps with having an automatic const variable initialized to it so that sysconf isn't at least called twice
during SetAlternateSignalStack.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D100645
(cherry picked from commit 82150606fb11d28813ae6da1101f5bda638165fe)
---
compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
index d29438c..2b10bdd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -165,7 +165,11 @@ bool SupportsColoredOutput(fd_t fd) {
#if !SANITIZER_GO
// TODO(glider): different tools may require different altstack size.
-static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough.
+static uptr GetAltStackSize() {
+ // SIGSTKSZ is not enough.
+ static const uptr kAltStackSize = SIGSTKSZ * 4;
+ return kAltStackSize;
+}
void SetAlternateSignalStack() {
stack_t altstack, oldstack;
@@ -176,10 +180,10 @@ void SetAlternateSignalStack() {
// TODO(glider): the mapped stack should have the MAP_STACK flag in the
// future. It is not required by man 2 sigaltstack now (they're using
// malloc()).
- void* base = MmapOrDie(kAltStackSize, __func__);
+ void *base = MmapOrDie(GetAltStackSize(), __func__);
altstack.ss_sp = (char*) base;
altstack.ss_flags = 0;
- altstack.ss_size = kAltStackSize;
+ altstack.ss_size = GetAltStackSize();
CHECK_EQ(0, sigaltstack(&altstack, nullptr));
}
@@ -187,7 +191,7 @@ void UnsetAlternateSignalStack() {
stack_t altstack, oldstack;
altstack.ss_sp = nullptr;
altstack.ss_flags = SS_DISABLE;
- altstack.ss_size = kAltStackSize; // Some sane value required on Darwin.
+ altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin.
CHECK_EQ(0, sigaltstack(&altstack, &oldstack));
UnmapOrDie(oldstack.ss_sp, oldstack.ss_size);
}
--
1.8.3.1

View File

@ -0,0 +1,54 @@
From 96339090681ae1dd9afe186ea14a460b61794707 Mon Sep 17 00:00:00 2001
From: serge-sans-paille <sguelton@redhat.com>
Date: Tue, 11 May 2021 14:38:21 +0200
Subject: [PATCH][compiler-rt] Prevent introduction of a dependency of
libasan.a on libstdc++
This an attempt to fix an issue introduced by https://reviews.llvm.org/D70662
Function-scope static initialization are guarded in C++, so we should probably
not use it because it introduces a dependency on __cxa_guard* symbols.
In the context of clang, libasan is linked statically, and it currently needs to
the odd situation where compiling C code with clang and asan requires -lstdc++.
I'm unsure of the portability requirements, providing a potential solution in
this review.
Differential Revision: https://reviews.llvm.org/D102475
---
compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
index 2b10bdd..818f1af 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -15,6 +15,7 @@
#if SANITIZER_POSIX
+#include "sanitizer_atomic.h"
#include "sanitizer_common.h"
#include "sanitizer_flags.h"
#include "sanitizer_platform_limits_netbsd.h"
@@ -166,9 +167,14 @@ bool SupportsColoredOutput(fd_t fd) {
#if !SANITIZER_GO
// TODO(glider): different tools may require different altstack size.
static uptr GetAltStackSize() {
- // SIGSTKSZ is not enough.
- static const uptr kAltStackSize = SIGSTKSZ * 4;
- return kAltStackSize;
+ static atomic_uintptr_t kAltStackSize{0};
+ uptr ret = atomic_load(&kAltStackSize, memory_order_relaxed);
+ if (ret == 0) {
+ // SIGSTKSZ is not enough.
+ ret = SIGSTKSZ * 4;
+ atomic_store(&kAltStackSize, ret, memory_order_relaxed);
+ }
+ return ret;
}
void SetAlternateSignalStack() {
--
1.8.3.1

View File

@ -0,0 +1,120 @@
From c9a8c70be89cfa62aa51862f4c8e0fa4c50134d2 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Thu, 20 May 2021 18:55:11 +0100
Subject: [PATCH][compiler-rt] libsanitizer: Remove cyclades inclusion in
sanitizer
The Linux kernel has removed the interface to cyclades from
the latest kernel headers[1] due to them being orphaned for the
past 13 years.
libsanitizer uses this header when compiling against glibc, but
glibcs itself doesn't seem to have any references to cyclades.
Further more it seems that the driver is broken in the kernel and
the firmware doesn't seem to be available anymore.
As such since this is breaking the build of libsanitizer (and so the
GCC bootstrap[2]) I propose to remove this.
[1] https://lkml.org/lkml/2021/3/2/153
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D102059
(cherry picked from commit 68d5235cb58f988c71b403334cd9482d663841ab)
---
.../sanitizer_common/sanitizer_common_interceptors_ioctl.inc | 9 ---------
.../lib/sanitizer_common/sanitizer_platform_limits_posix.cpp | 11 -----------
.../lib/sanitizer_common/sanitizer_platform_limits_posix.h | 10 ----------
3 files changed, 30 deletions(-)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
index 7f18125..b7da659 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
@@ -370,15 +370,6 @@ static void ioctl_table_fill() {
#if SANITIZER_GLIBC
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
- _(CYGETDEFTHRESH, WRITE, sizeof(int));
- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
- _(CYGETTHRESH, WRITE, sizeof(int));
- _(CYGETTIMEOUT, WRITE, sizeof(int));
- _(CYSETDEFTHRESH, NONE, 0);
- _(CYSETDEFTIMEOUT, NONE, 0);
- _(CYSETTHRESH, NONE, 0);
- _(CYSETTIMEOUT, NONE, 0);
_(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
_(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
_(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index 12dd39e..7abaeb8 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t;
# include <sys/procfs.h>
#endif
#include <sys/user.h>
-#include <linux/cyclades.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
@@ -459,7 +458,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
#if SANITIZER_GLIBC
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
#if EV_VERSION > (0x010000)
unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
#else
@@ -823,15 +821,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
- unsigned IOCTL_CYGETMON = CYGETMON;
- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 836b178..8a156b7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz;
#if SANITIZER_LINUX && !SANITIZER_ANDROID
extern unsigned struct_ax25_parms_struct_sz;
-extern unsigned struct_cyclades_monitor_sz;
extern unsigned struct_input_keymap_entry_sz;
extern unsigned struct_ipx_config_data_sz;
extern unsigned struct_kbdiacrs_sz;
@@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE;
#endif // SANITIZER_LINUX
#if SANITIZER_LINUX && !SANITIZER_ANDROID
-extern unsigned IOCTL_CYGETDEFTHRESH;
-extern unsigned IOCTL_CYGETDEFTIMEOUT;
-extern unsigned IOCTL_CYGETMON;
-extern unsigned IOCTL_CYGETTHRESH;
-extern unsigned IOCTL_CYGETTIMEOUT;
-extern unsigned IOCTL_CYSETDEFTHRESH;
-extern unsigned IOCTL_CYSETDEFTIMEOUT;
-extern unsigned IOCTL_CYSETTHRESH;
-extern unsigned IOCTL_CYSETTIMEOUT;
extern unsigned IOCTL_EQL_EMANCIPATE;
extern unsigned IOCTL_EQL_ENSLAVE;
extern unsigned IOCTL_EQL_GETMASTRCFG;
--
1.8.3.1

Binary file not shown.

View File

@ -1,6 +1,4 @@
#%%global rc_ver 6
%global baserelease 1
#%%global rc_ver 5
%global crt_srcdir compiler-rt-%{version}%{?rc_ver:rc%{rc_ver}}.src
@ -11,17 +9,20 @@
%global optflags %(echo %{optflags} -Dasm=__asm__)
Name: compiler-rt
Version: 11.0.0
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
Version: 12.0.0%{?rc_ver:~rc%{rc_ver}}
Release: 2%{?dist}
Summary: LLVM "compiler-rt" runtime libraries
License: NCSA or MIT
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{crt_srcdir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{crt_srcdir}.tar.xz.sig
Source2: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc
Source2: tstellar-gpg-key.asc
Patch0: 0001-PATCH-std-thread-copy.patch
Patch0: 0001-PATCH-compiler-rt-Workaround-libstdc-limitation-wrt..patch
Patch1: 0002-PATCH-compiler-rt-Sanitizer-built-against-glibc-2.34.patch
Patch3: 0003-PATCH-compiler-rt-Prevent-introduction-of-a-dependen.patch
Patch4: 0004-PATCH-compiler-rt-libsanitizer-Remove-cyclades-inclu.patch
# RHEL-specific patches
Patch100: 0001-Drop-fno-stack-protector-from-the-compiler-flags.patch
@ -34,7 +35,8 @@ BuildRequires: python3
# We need python3-devel for pathfix.py.
BuildRequires: python3-devel
BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-static = %{version}
Requires: clang-resource-filesystem%{?isa} = %{version}
%description
The compiler-rt project is a part of the LLVM project. It provides
@ -43,13 +45,15 @@ code generation, sanitizer runtimes and profiling library for code
instrumentation, and Blocks C language extension.
%prep
%autosetup -n %{crt_srcdir} -p1
%autosetup -n %{crt_srcdir} -p2
pathfix.py -i %{__python3} -pn lib/hwasan/scripts/hwasan_symbolize
%build
mkdir -p _build
cd _build
mkdir -p %{_vpath_builddir}
cd %{_vpath_builddir}
%cmake .. -GNinja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_CONFIG_PATH:FILEPATH=%{_bindir}/llvm-config-%{__isa_bits} \
@ -61,11 +65,12 @@ cd _build
%endif
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on?
%ninja_build
%cmake_build
%install
cd _build
%ninja_install
cd %{_vpath_builddir}
%cmake_install
# move blacklist/abilist files to where clang expect them
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/share
@ -92,23 +97,31 @@ do
target=`echo "$i" | sed -e 's/x86_64/i386/'`
ln -s ../../../../../lib/clang/%{version}/lib/$target ../../../../%{_lib}/clang/%{version}/lib/linux/
done
%endif
popd
%check
#make check-all -C _build
#%%cmake_build --target check-compiler-rt
%files
%license LICENSE.TXT
%{_includedir}/*
%{_libdir}/clang/%{version}
%{_libdir}/clang/%{version}/lib/*
%{_libdir}/clang/%{version}/share/*
%ifarch x86_64 aarch64
%{_bindir}/hwasan_symbolize
%endif
%changelog
* Tue May 25 2021 sguelton@redhat.com - 12.0.0-2
- Backport several compatibility patches
* Thu May 6 2021 sguelton@redhat.com - 12.0.0-1
- 12.0.0 release
* Thu Oct 29 2020 sguelton@redhat.com - 11.0.0-1
- 11.0.0 final release