Skip to content

Commit 0c8b366

Browse files
committed
Fix Clang error with JIT when EXT_C is disabled
When using 'make make ENABLE_EXT_C=0 ENABLE_JIT=1 CC=clang', the following errors are observed: rc/t2c.c:77:1: error: unused function 't2c_gen_ra_addr' [-Werror,-Wunused-function] 77 | T2C_LLVM_GEN_ADDR(ra, X, rv_reg_ra); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/t2c.c:64:31: note: expanded from macro 'T2C_LLVM_GEN_ADDR' 64 | FORCE_INLINE LLVMValueRef t2c_gen_##reg##_addr( \ | ^~~~~~~~~~~~~~~~~~~~ <scratch space>:75:1: note: expanded from here 75 | t2c_gen_ra_addr | ^~~~~~~~~~~~~~~ src/t2c.c:78:1: error: unused function 't2c_gen_sp_addr' [-Werror,-Wunused-function] 78 | T2C_LLVM_GEN_ADDR(sp, X, rv_reg_sp); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/t2c.c:64:31: note: expanded from macro 'T2C_LLVM_GEN_ADDR' 64 | FORCE_INLINE LLVMValueRef t2c_gen_##reg##_addr( \ | ^~~~~~~~~~~~~~~~~~~~ Fix this by guarding the 't2c_gen_ra_addr' and 't2c_gen_sp_addr' function definition with RV32_HAS(EXT_C) macro. This ensures the functions are only defined when the EXT_C is enabled.
1 parent ce8753c commit 0c8b366

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/t2c.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ FORCE_INLINE LLVMBasicBlockRef t2c_block_map_search(struct LLVM_block_map *map,
7474
T2C_LLVM_GEN_ADDR(rs1, X, ir->rs1);
7575
T2C_LLVM_GEN_ADDR(rs2, X, ir->rs2);
7676
T2C_LLVM_GEN_ADDR(rd, X, ir->rd);
77+
#if RV32_HAS(EXT_C)
7778
T2C_LLVM_GEN_ADDR(ra, X, rv_reg_ra);
7879
T2C_LLVM_GEN_ADDR(sp, X, rv_reg_sp);
80+
#endif
7981
T2C_LLVM_GEN_ADDR(PC, PC, 0);
8082

8183
#define T2C_LLVM_GEN_STORE_IMM32(builder, val, addr) \

0 commit comments

Comments
 (0)