Skip to content

Commit 531233d

Browse files
committed
Revert "add support for riscv64"
This reverts commit cd0a824, which breaks the build of compiler-rt for riscv64.
1 parent 537344f commit 531233d

File tree

10 files changed

+5
-103
lines changed

10 files changed

+5
-103
lines changed

clang/lib/Driver/ToolChains/Linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ SanitizerMask Linux::getSupportedSanitizers() const {
801801
IsRISCV64 || IsSystemZ || IsHexagon || IsLoongArch64)
802802
Res |= SanitizerKind::Leak;
803803
if (IsX86_64 || IsMIPS64 || IsAArch64 || IsPowerPC64 || IsSystemZ ||
804-
IsLoongArch64 || IsRISCV64)
804+
IsLoongArch64)
805805
Res |= SanitizerKind::Thread;
806806
if (IsX86_64 || IsSystemZ)
807807
Res |= SanitizerKind::KernelMemory;

compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ set(ALL_PROFILE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC32} ${PPC
6666
${MIPS32} ${MIPS64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
6767
${RISCV32} ${RISCV64} ${LOONGARCH64})
6868
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64} ${S390X}
69-
${LOONGARCH64} ${RISCV64})
69+
${LOONGARCH64})
7070
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
7171
${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
7272
${LOONGARCH64})

compiler-rt/lib/tsan/rtl/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ else()
220220
set(TSAN_ASM_SOURCES
221221
tsan_rtl_mips64.S
222222
)
223-
elseif(arch MATCHES "riscv64")
224-
set(TSAN_ASM_SOURCES
225-
tsan_rtl_riscv64.S
226-
)
227223
elseif(arch MATCHES "s390x")
228224
set(TSAN_ASM_SOURCES
229225
tsan_rtl_s390x.S

compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ struct ucontext_t {
8181
#define PTHREAD_ABI_BASE "GLIBC_2.17"
8282
#elif SANITIZER_LOONGARCH64
8383
#define PTHREAD_ABI_BASE "GLIBC_2.36"
84-
#elif SANITIZER_RISCV64
85-
#define PTHREAD_ABI_BASE "GLIBC_2.27"
8684
#endif
8785

8886
extern "C" int pthread_attr_init(void *attr);

compiler-rt/lib/tsan/rtl/tsan_platform.h

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -377,71 +377,6 @@ struct MappingPPC64_47 {
377377
static const uptr kMidAppMemEnd = 0;
378378
};
379379

380-
/*
381-
C/C++ on linux/riscv64 (39-bit VMA)
382-
0000 0010 00 - 0200 0000 00: main binary ( 8 GB)
383-
0200 0000 00 - 1000 0000 00: -
384-
1000 0000 00 - 4000 0000 00: shadow memory (64 GB)
385-
4000 0000 00 - 4800 0000 00: metainfo (16 GB)
386-
4800 0000 00 - 5500 0000 00: -
387-
5500 0000 00 - 5a00 0000 00: main binary (PIE) (~8 GB)
388-
5600 0000 00 - 7c00 0000 00: -
389-
7d00 0000 00 - 7fff ffff ff: libraries and main thread stack ( 8 GB)
390-
391-
mmap by default allocates from top downwards
392-
VDSO sits below loader and above dynamic libraries, within HiApp region.
393-
Heap starts after program region whose position depends on pie or non-pie.
394-
Disable tracking them since their locations are not fixed.
395-
*/
396-
struct MappingRiscv64_39 {
397-
static const uptr kLoAppMemBeg = 0x0000001000ull;
398-
static const uptr kLoAppMemEnd = 0x0200000000ull;
399-
static const uptr kShadowBeg = 0x1000000000ull;
400-
static const uptr kShadowEnd = 0x2000000000ull;
401-
static const uptr kMetaShadowBeg = 0x2000000000ull;
402-
static const uptr kMetaShadowEnd = 0x2400000000ull;
403-
static const uptr kMidAppMemBeg = 0x2aaaaaa000ull;
404-
static const uptr kMidAppMemEnd = 0x2c00000000ull;
405-
static const uptr kHeapMemBeg = 0x2c00000000ull;
406-
static const uptr kHeapMemEnd = 0x2c00000000ull;
407-
static const uptr kHiAppMemBeg = 0x3c00000000ull;
408-
static const uptr kHiAppMemEnd = 0x3fffffffffull;
409-
static const uptr kShadowMsk = 0x3800000000ull;
410-
static const uptr kShadowXor = 0x0800000000ull;
411-
static const uptr kShadowAdd = 0x0000000000ull;
412-
static const uptr kVdsoBeg = 0x4000000000ull;
413-
};
414-
415-
/*
416-
C/C++ on linux/riscv64 (48-bit VMA)
417-
0000 0000 1000 - 0500 0000 0000: main binary ( 5 TB)
418-
0500 0000 0000 - 2000 0000 0000: -
419-
2000 0000 0000 - 4000 0000 0000: shadow memory (32 TB)
420-
4000 0000 0000 - 4800 0000 0000: metainfo ( 8 TB)
421-
4800 0000 0000 - 5555 5555 5000: -
422-
5555 5555 5000 - 5a00 0000 0000: main binary (PIE) (~5 TB)
423-
5a00 0000 0000 - 7a00 0000 0000: -
424-
7a00 0000 0000 - 7fff ffff ffff: libraries and main thread stack ( 5 TB)
425-
*/
426-
struct MappingRiscv64_48 {
427-
static const uptr kLoAppMemBeg = 0x000000001000ull;
428-
static const uptr kLoAppMemEnd = 0x050000000000ull;
429-
static const uptr kShadowBeg = 0x200000000000ull;
430-
static const uptr kShadowEnd = 0x400000000000ull;
431-
static const uptr kMetaShadowBeg = 0x400000000000ull;
432-
static const uptr kMetaShadowEnd = 0x480000000000ull;
433-
static const uptr kMidAppMemBeg = 0x555555555000ull;
434-
static const uptr kMidAppMemEnd = 0x5a0000000000ull;
435-
static const uptr kHeapMemBeg = 0x5a0000000000ull;
436-
static const uptr kHeapMemEnd = 0x5a0000000000ull;
437-
static const uptr kHiAppMemBeg = 0x7a0000000000ull;
438-
static const uptr kHiAppMemEnd = 0x7fffffffffffull;
439-
static const uptr kShadowMsk = 0x700000000000ull;
440-
static const uptr kShadowXor = 0x100000000000ull;
441-
static const uptr kShadowAdd = 0x000000000000ull;
442-
static const uptr kVdsoBeg = 0x800000000000ull;
443-
};
444-
445380
/*
446381
C/C++ on linux/s390x
447382
While the kernel provides a 64-bit address space, we have to restrict ourselves
@@ -730,13 +665,6 @@ ALWAYS_INLINE auto SelectMapping(Arg arg) {
730665
}
731666
# elif defined(__mips64)
732667
return Func::template Apply<MappingMips64_40>(arg);
733-
# elif SANITIZER_RISCV64
734-
switch (vmaSize) {
735-
case 39:
736-
return Func::template Apply<MappingRiscv64_39>(arg);
737-
case 48:
738-
return Func::template Apply<MappingRiscv64_48>(arg);
739-
}
740668
# elif defined(__s390x__)
741669
return Func::template Apply<MappingS390x>(arg);
742670
# else
@@ -758,8 +686,6 @@ void ForEachMapping() {
758686
Func::template Apply<MappingPPC64_44>();
759687
Func::template Apply<MappingPPC64_46>();
760688
Func::template Apply<MappingPPC64_47>();
761-
Func::template Apply<MappingRiscv64_39>();
762-
Func::template Apply<MappingRiscv64_48>();
763689
Func::template Apply<MappingS390x>();
764690
Func::template Apply<MappingGo48>();
765691
Func::template Apply<MappingGoWindows>();
@@ -968,7 +894,7 @@ struct RestoreAddrImpl {
968894
Mapping::kMidAppMemEnd, Mapping::kHiAppMemBeg, Mapping::kHiAppMemEnd,
969895
Mapping::kHeapMemBeg, Mapping::kHeapMemEnd,
970896
};
971-
const uptr indicator = 0x0f0000000000ull;
897+
const uptr indicator = 0x0e0000000000ull;
972898
const uptr ind_lsb = 1ull << LeastSignificantSetBitIndex(indicator);
973899
for (uptr i = 0; i < ARRAY_SIZE(ranges); i += 2) {
974900
uptr beg = ranges[i];

compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,16 +267,6 @@ void InitializePlatformEarly() {
267267
Die();
268268
}
269269
# endif
270-
#elif SANITIZER_RISCV64
271-
// the bottom half of vma is allocated for userspace
272-
vmaSize = vmaSize + 1;
273-
# if !SANITIZER_GO
274-
if (vmaSize != 39 && vmaSize != 48) {
275-
Printf("FATAL: ThreadSanitizer: unsupported VMA range\n");
276-
Printf("FATAL: Found %zd - Supported 39 and 48\n", vmaSize);
277-
Die();
278-
}
279-
# endif
280270
#endif
281271
}
282272

@@ -409,8 +399,6 @@ static uptr UnmangleLongJmpSp(uptr mangled_sp) {
409399
return mangled_sp ^ xor_key;
410400
#elif defined(__mips__)
411401
return mangled_sp;
412-
#elif SANITIZER_RISCV64
413-
return mangled_sp;
414402
#elif defined(__s390x__)
415403
// tcbhead_t.stack_guard
416404
uptr xor_key = ((uptr *)__builtin_thread_pointer())[5];
@@ -441,8 +429,6 @@ static uptr UnmangleLongJmpSp(uptr mangled_sp) {
441429
# define LONG_JMP_SP_ENV_SLOT 1
442430
# elif defined(__mips64)
443431
# define LONG_JMP_SP_ENV_SLOT 1
444-
# elif SANITIZER_RISCV64
445-
# define LONG_JMP_SP_ENV_SLOT 13
446432
# elif defined(__s390x__)
447433
# define LONG_JMP_SP_ENV_SLOT 9
448434
# else

compiler-rt/lib/tsan/rtl/tsan_rtl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace __tsan {
5757
#if !SANITIZER_GO
5858
struct MapUnmapCallback;
5959
#if defined(__mips64) || defined(__aarch64__) || defined(__loongarch__) || \
60-
defined(__powerpc__) || SANITIZER_RISCV64
60+
defined(__powerpc__)
6161

6262
struct AP32 {
6363
static const uptr kSpaceBeg = 0;

compiler-rt/test/tsan/map32bit.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// XFAIL: target=powerpc64{{.*}}
1414
// XFAIL: target=s390x{{.*}}
1515
// XFAIL: target=loongarch64{{.*}}
16-
// XFAIL: target=riscv64{{.*}}
1716

1817
// MAP_32BIT doesn't exist on OS X and NetBSD.
1918
// UNSUPPORTED: darwin,target={{.*netbsd.*}}

compiler-rt/test/tsan/mmap_large.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
int main() {
1818
#ifdef __x86_64__
1919
const size_t kLog2Size = 39;
20-
#elif defined(__mips64) || defined(__aarch64__) || \
21-
defined(__loongarch_lp64) || (defined(__riscv) && __riscv_xlen == 64)
20+
#elif defined(__mips64) || defined(__aarch64__) || defined(__loongarch_lp64)
2221
const size_t kLog2Size = 32;
2322
#elif defined(__powerpc64__)
2423
const size_t kLog2Size = 39;

compiler-rt/test/tsan/test.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ unsigned long long monotonic_clock_ns() {
7676
const int kPCInc = 1;
7777
#elif defined(__sparc__) || defined(__mips__)
7878
const int kPCInc = 8;
79-
#elif defined(__riscv) && __riscv_xlen == 64
80-
const int kPCInc = 2;
8179
#else
8280
const int kPCInc = 4;
8381
#endif

0 commit comments

Comments
 (0)