Skip to content

Commit 5f02918

Browse files
IcenowyMingcongBai
authored andcommitted
arch/riscv64.sh: Disable emitting fence.tso on GCC 15+
GCC 15 introduces a new compiler flag, `-m{,no-}fence-tso`, to control the usage of `fence.tso` instruction (which is not supported on some old T-Head cores, such as the ones used on TH1520/SG2042). When it's disabled, more strong `fence rw,rw` is emitted and correctness is then not affected. Disable emitting this instruction now, because all buildbots of riscv64 are currently SG2042, and no CPU cores are known to benefit from `fence.tso` yet. Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
1 parent 105e534 commit 5f02918

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/riscv64.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
if ! bool "$USECLANG" && [ "$(echo __GNUC__ | $CC -E -xc - | tail -n 1)" -ge 14 ]; then
77
CFLAGS_COMMON_ARCH=('-mno-omit-leaf-frame-pointer')
88
fi
9+
# `-mno-fence-tso` is only available on GCC >= 15
10+
if ! bool "$USECLANG" && [ "$(echo __GNUC__ | $CC -E -xc - | tail -n 1)" -ge 15 ]; then
11+
CFLAGS_COMMON_ARCH+=('-mno-fence-tso')
12+
fi
913
LDFLAGS_CLANG_ARCH=('-fuse-ld=lld' '-Wl,-mllvm=-mattr=+rva20u64')
1014
LDFLAGS_COMMON_CROSS=('-Wl,-rpath -Wl,/usr/lib -Wl,-rpath-link' '-Wl,/var/ab/cross-root/riscv64/usr/lib' '-L/var/ab/cross-root/riscv64/usr/lib')
1115
RUSTFLAGS_COMMON_ARCH=("-Clink-arg=-mabi=lp64d")

0 commit comments

Comments
 (0)