From d8aee9b26e23981b2284c504e639018f4872aa6b Mon Sep 17 00:00:00 2001 From: Meng Zhuo Date: Fri, 12 Jun 2026 09:51:00 +0800 Subject: [PATCH] riscv64: consolidate riscv intrinsics into lib-riscv.c Replace the single-purpose lib/riscvflush.c with lib/lib-riscv.c following the lib-arm64.c naming convention. --- lib/Makefile | 2 +- lib/lib-riscv.c | 20 ++++++++++++++++++++ lib/riscvflush.c | 10 ---------- 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 lib/lib-riscv.c delete mode 100644 lib/riscvflush.c diff --git a/lib/Makefile b/lib/Makefile index 3ac6f8f0..51c901d8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -73,7 +73,7 @@ OBJ-arm-vfp = $(OBJ-arm) OBJ-arm-eabi = $(OBJ-arm) OBJ-arm-eabihf = $(OBJ-arm) OBJ-arm-wince = $(ARM_O) $(WIN_O) -OBJ-riscv64 = $(RISCV64_O) riscvflush.o $(LIN_O) +OBJ-riscv64 = $(RISCV64_O) lib-riscv.o $(LIN_O) OBJ-extra = $(filter $(EXTRA_O),$(OBJ-$T)) OBJ-libtcc1 = $(addprefix $(X),$(filter-out $(OBJ-extra),$(OBJ-$T))) diff --git a/lib/lib-riscv.c b/lib/lib-riscv.c new file mode 100644 index 00000000..b76220c3 --- /dev/null +++ b/lib/lib-riscv.c @@ -0,0 +1,20 @@ +/* + * TCC runtime library for riscv64. + * + * Copyright (c) 2026 + * + * Copying and distribution of this file, with or without modification, + * are permitted in any medium without royalty provided the copyright + * notice and this notice are preserved. This file is offered as-is, + * without any warranty. + */ + +/* ------------------------------------------------------------- */ +/* __clear_cache is used in tccrun.c. It is a built-in + intrinsic with gcc. However tcc in order to compile + itself needs this function */ + +void __clear_cache(void *beg, void *end) +{ + __riscv64_clear_cache(beg, end); +} diff --git a/lib/riscvflush.c b/lib/riscvflush.c deleted file mode 100644 index 995bbfc8..00000000 --- a/lib/riscvflush.c +++ /dev/null @@ -1,10 +0,0 @@ -/* riscvflush.c - flush the instruction cache - - __clear_cache is used in tccrun.c, It is a built-in - intrinsic with gcc. However tcc in order to compile - itself needs this function */ - -void __clear_cache(void *beg, void *end) -{ - __riscv64_clear_cache(beg, end); -}