From c890f45e670f3accdbecb1fce28f00d390b09ec4 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 22 Aug 2022 16:32:12 +0000 Subject: Allow building without -fcommon The sail C code generator will emit definions for these structs. The duplicate definition linker error were worked around by adding -fcommon in ffea7a39c32a210a446379aeda0eabcec4918ed6. This commit fixes the underlying issue by declaring the variables as `extern`. --- c_emulator/riscv_sail.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'c_emulator') diff --git a/c_emulator/riscv_sail.h b/c_emulator/riscv_sail.h index cac8316..bc5ce04 100644 --- a/c_emulator/riscv_sail.h +++ b/c_emulator/riscv_sail.h @@ -7,7 +7,7 @@ typedef int unit; typedef uint64_t mach_bits; struct zMisa {mach_bits zMisa_chunk_0;}; -struct zMisa zmisa; +extern struct zMisa zmisa; void model_init(void); void model_fini(void); @@ -67,6 +67,6 @@ extern mach_bits zsepc, zstval; extern mach_bits zfloat_result, zfloat_fflags; struct zMcause {mach_bits zMcause_chunk_0;}; -struct zMcause zmcause, zscause; +extern struct zMcause zmcause, zscause; extern mach_bits zminstret; -- cgit v1.1