Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
18a56e1b79
!39 [sync] PR-38: [Backport][LoongArch] Improve the support for compiler-rt
From: @openeuler-sync-bot 
Reviewed-by: @cf-zhao 
Signed-off-by: @cf-zhao
2024-04-12 07:22:14 +00:00
Ami-zhang
d51b7795b1 [Backport][LoongArch] Improve the support for compiler-rt
(cherry picked from commit c39a3c6738fab39c3799f36f91b15aa6f0519c90)
2024-04-12 10:21:53 +08:00
openeuler-ci-bot
477390f07c
!37 Fix an unpackaged file issue on riscv64
From: @jchzhou 
Reviewed-by: @cf-zhao 
Signed-off-by: @cf-zhao
2024-03-05 07:14:16 +00:00
jchzhou
6c636e3574 Fix an unpackaged file issue on riscv64 2024-02-23 22:29:19 +08:00
openeuler-ci-bot
248a2f9967
!36 Update to 17.0.6
From: @zj94 
Reviewed-by: @liyunfei33, @cf-zhao 
Signed-off-by: @cf-zhao
2024-01-05 02:01:12 +00:00
zhoujing
7fa4001724 Update to 17.0.6 2024-01-04 17:39:10 +08:00
openeuler-ci-bot
1cd382a557
!32 Change the install path
From: @cf-zhao 
Reviewed-by: @eastb233 
Signed-off-by: @eastb233
2023-07-20 09:21:08 +00:00
cf_zhao
5a14302d6f Change the install path 2023-07-20 17:02:57 +08:00
openeuler-ci-bot
b30433ec14
!27 [Compiler-rt][RUNPATH] Delete run path in DSO
From: @eastb233 
Reviewed-by: @zhongyunde, @cf-zhao 
Signed-off-by: @cf-zhao
2022-12-20 08:58:32 +00:00
eastb233
5619260529 [Compiler-rt][RUNPATH] Delete run path in DSO 2022-12-20 15:27:20 +08:00
9 changed files with 535 additions and 103 deletions

View File

@ -0,0 +1,425 @@
From 0bce68310dc0ff6a09ec2cf5c3ae32400c631324 Mon Sep 17 00:00:00 2001
From: zhanglimin <zhanglimin@loongson.cn>
Date: Tue, 12 Sep 2023 09:51:16 +0800
Subject: [PATCH 1/5] [sanitizer][msan] VarArgHelper for loongarch64
This patch adds support for variadic argument for loongarch64,
which is based on MIPS64. And `check-msan` all pass.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D158587
(cherry picked from commit ec42c78cc43ac1e8364e5a0941aa5fc91b813dd3)
---
compiler-rt/test/msan/signal_stress_test.cpp | 3 ---
1 file changed, 3 deletions(-)
diff --git a/compiler-rt/test/msan/signal_stress_test.cpp b/compiler-rt/test/msan/signal_stress_test.cpp
index aade0f1f4051..043393fce6de 100644
--- a/compiler-rt/test/msan/signal_stress_test.cpp
+++ b/compiler-rt/test/msan/signal_stress_test.cpp
@@ -5,9 +5,6 @@
// Reported deadly signal due to stack-overflow
// XFAIL: target={{.*netbsd.*}}
-// VarArg implementation on LoongArch isn't supported yet.
-// UNSUPPORTED: target=loongarch{{.*}}
-
#include <signal.h>
#include <stdarg.h>
#include <sanitizer/msan_interface.h>
--
2.20.1
From faa4482d1f713331a4ac4b0a58ea9804f6c32371 Mon Sep 17 00:00:00 2001
From: Ami-zhang <96056515+Ami-zhang@users.noreply.github.com>
Date: Thu, 28 Sep 2023 15:40:42 +0800
Subject: [PATCH 2/5] [CFI] Allow LoongArch (#67314)
Enable icall tests on loongarch64 and `check-cfi` all pass.
(cherry picked from commit adb555ea369a3a989a9db619c784aa76cccdb823)
---
compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake | 2 +-
compiler-rt/lib/cfi/cfi.cpp | 4 ++++
compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp | 11 +++++++++--
compiler-rt/test/cfi/cross-dso/icall/lit.local.cfg.py | 2 +-
compiler-rt/test/cfi/icall/lit.local.cfg.py | 2 +-
5 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index d14745ef9d13..9b0a4655cd65 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -73,7 +73,7 @@ set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${MIPS32} ${MIPS64}
${HEXAGON} ${LOONGARCH64})
set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS64}
- ${HEXAGON})
+ ${HEXAGON} ${LOONGARCH64})
set(ALL_SCUDO_STANDALONE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
${MIPS32} ${MIPS64} ${PPC64} ${HEXAGON} ${LOONGARCH64} ${RISCV64})
if(APPLE)
diff --git a/compiler-rt/lib/cfi/cfi.cpp b/compiler-rt/lib/cfi/cfi.cpp
index 22f0b175dd87..ad1c91623514 100644
--- a/compiler-rt/lib/cfi/cfi.cpp
+++ b/compiler-rt/lib/cfi/cfi.cpp
@@ -51,7 +51,11 @@ using namespace __sanitizer;
namespace __cfi {
+#if SANITIZER_LOONGARCH64
+#define kCfiShadowLimitsStorageSize 16384 // 16KiB on loongarch64 per page
+#else
#define kCfiShadowLimitsStorageSize 4096 // 1 page
+#endif
// Lets hope that the data segment is mapped with 4K pages.
// The pointer to the cfi shadow region is stored at the start of this page.
// The rest of the page is unused and re-mapped read-only.
diff --git a/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp b/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp
index c9674c3fb412..d04f7ba5dd0e 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp
+++ b/compiler-rt/test/cfi/cross-dso/icall/dlopen.cpp
@@ -53,6 +53,13 @@ struct A {
virtual void f();
};
+// The page size of LoongArch is 16KiB, aligned to the memory page size.
+#ifdef __loongarch__
+# define PAGESIZE 16384
+#else
+# define PAGESIZE 4096
+#endif
+
#ifdef SHARED_LIB
#include "../../utils.h"
@@ -66,13 +73,13 @@ extern "C" void *create_B() {
return (void *)(new B());
}
-extern "C" __attribute__((aligned(4096))) void do_nothing() {}
+extern "C" __attribute__((aligned(PAGESIZE))) void do_nothing() {}
#else
void A::f() {}
-static const int kCodeAlign = 4096;
+static const int kCodeAlign = PAGESIZE;
static const int kCodeSize = 4096;
static char saved_code[kCodeSize];
static char *real_start;
diff --git a/compiler-rt/test/cfi/cross-dso/icall/lit.local.cfg.py b/compiler-rt/test/cfi/cross-dso/icall/lit.local.cfg.py
index 749c265bbf1c..6e64199ed5c5 100644
--- a/compiler-rt/test/cfi/cross-dso/icall/lit.local.cfg.py
+++ b/compiler-rt/test/cfi/cross-dso/icall/lit.local.cfg.py
@@ -1,3 +1,3 @@
# The cfi-icall checker is only supported on x86 and x86_64 for now.
-if config.root.host_arch not in ["x86", "x86_64"]:
+if config.root.host_arch not in ["x86", "x86_64", "loongarch64"]:
config.unsupported = True
diff --git a/compiler-rt/test/cfi/icall/lit.local.cfg.py b/compiler-rt/test/cfi/icall/lit.local.cfg.py
index 749c265bbf1c..6e64199ed5c5 100644
--- a/compiler-rt/test/cfi/icall/lit.local.cfg.py
+++ b/compiler-rt/test/cfi/icall/lit.local.cfg.py
@@ -1,3 +1,3 @@
# The cfi-icall checker is only supported on x86 and x86_64 for now.
-if config.root.host_arch not in ["x86", "x86_64"]:
+if config.root.host_arch not in ["x86", "x86_64", "loongarch64"]:
config.unsupported = True
--
2.20.1
From c1b7fb975564f8d372b7af81e90519c47935d1b7 Mon Sep 17 00:00:00 2001
From: Ami-zhang <zhanglimin@loongson.cn>
Date: Fri, 27 Oct 2023 16:52:10 +0800
Subject: [PATCH 3/5] [test][compiler-rt] Mark several tests as UNSUPPORTED on
LoongArch (#69699)
(cherry picked from commit 75b0a99668cef7abaf36e09c41bb1eb91234bbf3)
---
compiler-rt/test/fuzzer/exit_on_src_pos.test | 2 ++
.../test/sanitizer_common/TestCases/Linux/odd_stack_size.cpp | 2 ++
.../sanitizer_common/TestCases/Linux/release_to_os_test.cpp | 2 +-
compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp | 2 ++
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/test/fuzzer/exit_on_src_pos.test b/compiler-rt/test/fuzzer/exit_on_src_pos.test
index 541e0c4c6e42..020424e2d9fd 100644
--- a/compiler-rt/test/fuzzer/exit_on_src_pos.test
+++ b/compiler-rt/test/fuzzer/exit_on_src_pos.test
@@ -6,6 +6,8 @@
# Test does not complete on Armv7 Thumb build bot
UNSUPPORTED: target=thumb{{.*}}
+# Timeout on loongarch64 machine
+UNSUPPORTED: target=loongarch64{{.*}}
RUN: %cpp_compiler -O0 %S/SimpleTest.cpp -o %t-SimpleTest.exe -mllvm -use-unknown-locations=Disable
RUN: %cpp_compiler -O0 %S/ShrinkControlFlowTest.cpp -o %t-ShrinkControlFlowTest.exe
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/odd_stack_size.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/odd_stack_size.cpp
index fc31212b7f18..9d7d46b462a8 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/odd_stack_size.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/odd_stack_size.cpp
@@ -5,6 +5,8 @@
// AddressSanitizer: CHECK failed: asan_thread.cpp:315 "((AddrIsInStack((uptr)&local))) != (0)"
// https://lab.llvm.org/buildbot/#/builders/18/builds/8162
// UNSUPPORTED: target=powerpc64{{.*}}
+/// Occasionally fail on loongarch64 machine
+// UNSUPPORTED: target=loongarch64{{.*}}
#include <assert.h>
#include <stdlib.h>
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/release_to_os_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/release_to_os_test.cpp
index 67351a916441..0fa77200bf1c 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/release_to_os_test.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/release_to_os_test.cpp
@@ -3,7 +3,7 @@
// Temporarily disable test
// UNSUPPORTED: tsan
-// UNSUPPORTED: target=powerpc64{{.*}}
+// UNSUPPORTED: target={{(powerpc64|loongarch64).*}}
// Not needed, no allocator.
// UNSUPPORTED: ubsan
diff --git a/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp b/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
index 3065981a2c9a..0ee8aaa755d5 100644
--- a/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
+++ b/compiler-rt/test/xray/TestCases/Posix/fdr-mode.cpp
@@ -19,6 +19,8 @@
// RUN: rm fdr-logging-test-*
// RUN: rm fdr-unwrite-test-*
// UNSUPPORTED: target=powerpc64le-{{.*}}
+/// TODO: FDR logging arg1 handler(__xray_ArgLoggerEntry) hasn't implemented yet on LoongArch
+// UNSUPPORTED: target=loongarch64{{.*}}
// REQUIRES: built-in-llvm-tree
#include "xray/xray_log_interface.h"
--
2.20.1
From 6ff7bf14a7bbb438f58fc20dd56a2adf157022f3 Mon Sep 17 00:00:00 2001
From: abner chenc <chenguoqi@loongson.cn>
Date: Thu, 28 Dec 2023 18:54:35 +0800
Subject: [PATCH 4/5] [tsan] Add support for linux/loongarch64 in
lib/tsan/go/buildgo.sh (#72819)
Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
(cherry picked from commit 9d3fbf97bef3f19da4e0a047f017b8142f59b3fd)
---
compiler-rt/lib/tsan/go/buildgo.sh | 2 ++
compiler-rt/lib/tsan/rtl/tsan_platform.h | 32 +++++++++++++++++++
.../lib/tsan/rtl/tsan_platform_linux.cpp | 8 ++++-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/compiler-rt/lib/tsan/go/buildgo.sh b/compiler-rt/lib/tsan/go/buildgo.sh
index 0bd59368cc46..78ba41a0bdc6 100755
--- a/compiler-rt/lib/tsan/go/buildgo.sh
+++ b/compiler-rt/lib/tsan/go/buildgo.sh
@@ -10,6 +10,8 @@ if [ "`uname -a | grep Linux`" != "" ]; then
HOST_GOARCH="amd64"
elif [ "`uname -a | grep aarch64`" != "" ]; then
HOST_GOARCH="arm64"
+ elif [ "`uname -a | grep loongarch64`" != "" ]; then
+ HOST_GOARCH="loong64"
elif [ "`uname -a | grep -i mips64`" != "" ]; then
if [ "`lscpu | grep -i Little`" != "" ]; then
HOST_GOARCH="mips64le"
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h
index f0cdaf48eaa3..48dd56d15751 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h
@@ -558,6 +558,35 @@ struct MappingGoAarch64 {
static const uptr kShadowAdd = 0x200000000000ull;
};
+/* Go on linux/loongarch64 (47-bit VMA)
+0000 0000 1000 - 0000 1000 0000: executable
+0000 1000 0000 - 00c0 0000 0000: -
+00c0 0000 0000 - 00e0 0000 0000: heap
+00e0 0000 0000 - 2000 0000 0000: -
+2000 0000 0000 - 2800 0000 0000: shadow
+2800 0000 0000 - 3000 0000 0000: -
+3000 0000 0000 - 3200 0000 0000: metainfo (memory blocks and sync objects)
+3200 0000 0000 - 8000 0000 0000: -
+*/
+struct MappingGoLoongArch64_47 {
+ static const uptr kMetaShadowBeg = 0x300000000000ull;
+ static const uptr kMetaShadowEnd = 0x320000000000ull;
+ static const uptr kShadowBeg = 0x200000000000ull;
+ static const uptr kShadowEnd = 0x280000000000ull;
+ static const uptr kLoAppMemBeg = 0x000000001000ull;
+ static const uptr kLoAppMemEnd = 0x00e000000000ull;
+ static const uptr kMidAppMemBeg = 0;
+ static const uptr kMidAppMemEnd = 0;
+ static const uptr kHiAppMemBeg = 0;
+ static const uptr kHiAppMemEnd = 0;
+ static const uptr kHeapMemBeg = 0;
+ static const uptr kHeapMemEnd = 0;
+ static const uptr kVdsoBeg = 0;
+ static const uptr kShadowMsk = 0;
+ static const uptr kShadowXor = 0;
+ static const uptr kShadowAdd = 0x200000000000ull;
+};
+
/*
Go on linux/mips64 (47-bit VMA)
0000 0000 1000 - 0000 1000 0000: executable
@@ -633,6 +662,8 @@ ALWAYS_INLINE auto SelectMapping(Arg arg) {
return Func::template Apply<MappingGoS390x>(arg);
# elif defined(__aarch64__)
return Func::template Apply<MappingGoAarch64>(arg);
+# elif defined(__loongarch_lp64)
+ return Func::template Apply<MappingGoLoongArch64_47>(arg);
# elif SANITIZER_WINDOWS
return Func::template Apply<MappingGoWindows>(arg);
# else
@@ -692,6 +723,7 @@ void ForEachMapping() {
Func::template Apply<MappingGoPPC64_46>();
Func::template Apply<MappingGoPPC64_47>();
Func::template Apply<MappingGoAarch64>();
+ Func::template Apply<MappingGoLoongArch64_47>();
Func::template Apply<MappingGoMips64_47>();
Func::template Apply<MappingGoS390x>();
}
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
index 384a443c16b0..3f4a3760794f 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
@@ -238,7 +238,13 @@ void InitializePlatformEarly() {
Printf("FATAL: Found %zd - Supported 47\n", vmaSize);
Die();
}
-# endif
+# else
+ if (vmaSize != 47) {
+ Printf("FATAL: ThreadSanitizer: unsupported VMA range\n");
+ Printf("FATAL: Found %zd - Supported 47\n", vmaSize);
+ Die();
+ }
+# endif
#elif defined(__powerpc64__)
# if !SANITIZER_GO
if (vmaSize != 44 && vmaSize != 46 && vmaSize != 47) {
--
2.20.1
From ffa86e49836d567aa6b817563d1e4b99dc5f21c7 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i@maskray.me>
Date: Tue, 26 Mar 2024 14:09:39 -0700
Subject: [PATCH 5/5] [tsan] Refine fstat{,64} interceptors (#86625)
In glibc versions before 2.33. `libc_nonshared.a` defines
`__fxstat/__fxstat64` but there is no `fstat/fstat64`. glibc 2.33 added
`fstat/fstat64` and obsoleted `__fxstat/__fxstat64`. Ports added after
2.33 do not provide `__fxstat/__fxstat64`, so our `fstat/fstat64`
interceptors using `__fxstat/__fxstat64` interceptors would lead to
runtime failures on such ports (LoongArch and certain RISC-V ports).
Similar to https://reviews.llvm.org/D118423, refine the conditions that
we define fstat{,64} interceptors. `fstat` is supported by musl/*BSD
while `fstat64` is glibc only.
(cherry picked from commit d5224b73ccd09a6759759791f58426b6acd4a2e2)
---
.../lib/tsan/rtl/tsan_interceptors_posix.cpp | 43 ++++++++-----------
1 file changed, 18 insertions(+), 25 deletions(-)
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
index 177e338bf282..622afc90a577 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
@@ -14,6 +14,7 @@
#include "sanitizer_common/sanitizer_atomic.h"
#include "sanitizer_common/sanitizer_errno.h"
+#include "sanitizer_common/sanitizer_glibc_version.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_linux.h"
#include "sanitizer_common/sanitizer_platform_limits_netbsd.h"
@@ -1595,47 +1596,40 @@ TSAN_INTERCEPTOR(int, __fxstat, int version, int fd, void *buf) {
FdAccess(thr, pc, fd);
return REAL(__fxstat)(version, fd, buf);
}
-#define TSAN_MAYBE_INTERCEPT___FXSTAT TSAN_INTERCEPT(__fxstat)
+
+TSAN_INTERCEPTOR(int, __fxstat64, int version, int fd, void *buf) {
+ SCOPED_TSAN_INTERCEPTOR(__fxstat64, version, fd, buf);
+ if (fd > 0)
+ FdAccess(thr, pc, fd);
+ return REAL(__fxstat64)(version, fd, buf);
+}
+#define TSAN_MAYBE_INTERCEPT___FXSTAT TSAN_INTERCEPT(__fxstat); TSAN_INTERCEPT(__fxstat64)
#else
#define TSAN_MAYBE_INTERCEPT___FXSTAT
#endif
+#if !SANITIZER_GLIBC || __GLIBC_PREREQ(2, 33)
TSAN_INTERCEPTOR(int, fstat, int fd, void *buf) {
-#if SANITIZER_GLIBC
- SCOPED_TSAN_INTERCEPTOR(__fxstat, 0, fd, buf);
- if (fd > 0)
- FdAccess(thr, pc, fd);
- return REAL(__fxstat)(0, fd, buf);
-#else
SCOPED_TSAN_INTERCEPTOR(fstat, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
return REAL(fstat)(fd, buf);
-#endif
-}
-
-#if SANITIZER_GLIBC
-TSAN_INTERCEPTOR(int, __fxstat64, int version, int fd, void *buf) {
- SCOPED_TSAN_INTERCEPTOR(__fxstat64, version, fd, buf);
- if (fd > 0)
- FdAccess(thr, pc, fd);
- return REAL(__fxstat64)(version, fd, buf);
}
-#define TSAN_MAYBE_INTERCEPT___FXSTAT64 TSAN_INTERCEPT(__fxstat64)
+# define TSAN_MAYBE_INTERCEPT_FSTAT TSAN_INTERCEPT(fstat)
#else
-#define TSAN_MAYBE_INTERCEPT___FXSTAT64
+# define TSAN_MAYBE_INTERCEPT_FSTAT
#endif
-#if SANITIZER_GLIBC
+#if __GLIBC_PREREQ(2, 33)
TSAN_INTERCEPTOR(int, fstat64, int fd, void *buf) {
- SCOPED_TSAN_INTERCEPTOR(__fxstat64, 0, fd, buf);
+ SCOPED_TSAN_INTERCEPTOR(fstat64, fd, buf);
if (fd > 0)
FdAccess(thr, pc, fd);
- return REAL(__fxstat64)(0, fd, buf);
+ return REAL(fstat64)(fd, buf);
}
-#define TSAN_MAYBE_INTERCEPT_FSTAT64 TSAN_INTERCEPT(fstat64)
+# define TSAN_MAYBE_INTERCEPT_FSTAT64 TSAN_INTERCEPT(fstat64)
#else
-#define TSAN_MAYBE_INTERCEPT_FSTAT64
+# define TSAN_MAYBE_INTERCEPT_FSTAT64
#endif
TSAN_INTERCEPTOR(int, open, const char *name, int oflag, ...) {
@@ -2929,10 +2923,9 @@ void InitializeInterceptors() {
TSAN_INTERCEPT(pthread_once);
- TSAN_INTERCEPT(fstat);
TSAN_MAYBE_INTERCEPT___FXSTAT;
+ TSAN_MAYBE_INTERCEPT_FSTAT;
TSAN_MAYBE_INTERCEPT_FSTAT64;
- TSAN_MAYBE_INTERCEPT___FXSTAT64;
TSAN_INTERCEPT(open);
TSAN_MAYBE_INTERCEPT_OPEN64;
TSAN_INTERCEPT(creat);
--
2.20.1

View File

@ -1,43 +0,0 @@
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

21
README.en.md Normal file
View File

@ -0,0 +1,21 @@
# compiler-rt
#### Description
The llvm compiler support routines
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# compiler-rt
#### 介绍
The llvm compiler support routines
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,17 +1,41 @@
%bcond_without sys_llvm
%bcond_without check
%global maj_ver 17
%global min_ver 0
%global patch_ver 6
%global crt_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global crt_srcdir compiler-rt-%{version}%{?rc_ver:rc%{rc_ver}}.src
%global optflags %(echo %{optflags} -D_DEFAULT_SOURCE)
%global optflags %(echo %{optflags} -Dasm=__asm__)
Name: compiler-rt
Version: 12.0.1
Release: 1
%if %{with sys_llvm}
%global pkg_name compiler-rt
%global install_prefix %{_prefix}
%global install_datadir %{_datadir}
%else
%global pkg_name compiler-rt%{maj_ver}
%global install_prefix %{_libdir}/llvm%{maj_ver}
%global install_datadir %{install_prefix}/share
%endif
%if 0%{?__isa_bits} == 64
%global install_libdir %{install_prefix}/lib64
%else
%global install_libdir %{install_prefix}/lib
%endif
Name: %{pkg_name}
Version: %{crt_version}
Release: 3
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}/%{crt_srcdir}.tar.xz
Source2: tstellar-gpg-key.asc
Patch0: 0001-PATCH-compiler-rt-Workaround-libstdc-limitation-wrt..patch
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz.sig
Patch1: 0001-Backport-LoongArch-improve-the-support-for-compiler-rt.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -20,11 +44,16 @@ BuildRequires: ninja-build
BuildRequires: python3
# We need python3-devel for pathfix.py.
BuildRequires: python3-devel
BuildRequires: llvm-devel = %{version}
# For gpg source verification
BuildRequires: gnupg2
Requires: clang-resource-filesystem%{?isa} = %{version}
%if %{with sys_llvm}
BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-test = %{version}
BuildRequires: llvm-cmake-utils = %{version}
%else
BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-test = %{version}
BuildRequires: llvm%{maj_ver}-cmake-utils = %{version}
%endif
%description
The compiler-rt project is a part of the LLVM project. It provides
@ -34,15 +63,22 @@ instrumentation, and Blocks C language extension.
%prep
%autosetup -n %{crt_srcdir} -p2
# compiler-rt does not allow configuring LLVM_COMMON_CMAKE_UTILS.
ln -s %{install_datadir}/llvm/cmake ../cmake
pathfix.py -i %{__python3} -pn lib/hwasan/scripts/hwasan_symbolize
%build
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
export ASMFLAGS=$CFLAGS
mkdir -p _build
cd _build
%cmake .. \
%cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_CONFIG_PATH:FILEPATH=%{_bindir}/llvm-config-%{__isa_bits} \
\
-DCMAKE_MODULE_PATH=%{install_libdir}/cmake/llvm \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DCOMPILER_RT_INSTALL_PATH=%{install_libdir}/clang/%{maj_ver} \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
%if 0%{?__isa_bits} == 64
-DLLVM_LIBDIR_SUFFIX=64 \
%else
@ -56,63 +92,35 @@ cd _build
cd _build
%make_install
# move blacklist/abilist files to where clang expect them
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/share
mv -v %{buildroot}%{_datadir}/*list.txt %{buildroot}%{_libdir}/clang/%{version}/share/
# move sanitizer libs to better place
%global libclang_rt_installdir lib/linux
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib
mv -v %{buildroot}%{_prefix}/%{libclang_rt_installdir}/*clang_rt* %{buildroot}%{_libdir}/clang/%{version}/lib
mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib/linux/
pushd %{buildroot}%{_libdir}/clang/%{version}/lib
for i in *.a *.so
do
ln -s ../$i linux/$i
done
popd
# multilib support: also create symlink from lib to lib64, fixes rhbz#1678240
# the symlinks will be dangling if the 32 bits version is not installed, but that should be fine
%ifarch %{ix86}
%post
if test "`uname -m`" = x86_64
then
cd %{_libdir}/clang/%{version}/lib
mkdir -p ../../../../lib64/clang/%{version}/lib
for i in *.a *.so
do
ln -s ../../../../%{_lib}/clang/%{version}/lib/$i ../../../../lib64/clang/%{version}/lib/$i
done
fi
%preun
if test "`uname -m`" = x86_64
then
cd %{_libdir}/clang/%{version}/lib
for i in *.a *.so
do
rm ../../../../lib64/clang/%{version}/lib/$i
done
rmdir -p ../../../../lib64/clang/%{version}/lib 2>/dev/null 1>/dev/null || :
fi
%endif
%check
#%%cmake_build --target check-compiler-rt
%files
%license LICENSE.TXT
%{_includedir}/*
%{_libdir}/clang/%{version}/lib/*
%{_libdir}/clang/%{version}/share/*
%ifarch x86_64 aarch64
%{_bindir}/hwasan_symbolize
%ifarch x86_64 aarch64 riscv64
%{install_libdir}/clang/%{maj_ver}/bin/*
%endif
%{install_libdir}/clang/%{maj_ver}/include/*
%{install_libdir}/clang/%{maj_ver}/lib/*
%{install_libdir}/clang/%{maj_ver}/share/*
%ifarch x86_64 aarch64 riscv64
%{install_libdir}/clang/%{maj_ver}/bin/hwasan_symbolize
%endif
%changelog
* Wed Apr 03 2024 zhanglimin <zhanglimin@loongson.cn> - 17.0.6-3
- Improve the support for compiler-rt on LoongArch
* Fri Feb 23 2024 jchzhou <zhoujiacheng@iscas.ac.cn> - 17.0.6-2
- Fix an unpackaged file issue on riscv64
* Tue Dec 5 2023 zhoujing <zhoujing106@huawei.com> - 17.0.6-1
- Update to 17.0.6
* Tue Dec 20 2022 eastb233 <xiezhiheng@huawei.com> - 12.0.1-2
- Delete run path in DSO
* Mon Dec 27 2021 Chen Chen <chen_aka_jan@163.com> - 12.0.1-1
- Update to 12.0.1

Binary file not shown.