diff mbox series

[kvm-unit-tests,v2,2/4] riscv: Build with explicit ABI

Message ID 20240808154223.79686-8-andrew.jones@linux.dev (mailing list archive)
State New, archived
Headers show
Series riscv: Extend CI | expand

Commit Message

Andrew Jones Aug. 8, 2024, 3:42 p.m. UTC
If we add -mabi to the command line then compilers that are built
to support multiple ABIs may be used for both rv32 and rv64 builds,
so add it for that reason. We also need the right linker flags, so
add those too and throw in a trimming of the ISA string (drop fd)
in order to keep it minimal.

Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
---
 riscv/Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/riscv/Makefile b/riscv/Makefile
index b0cd613fcd8c..7906cef7f199 100644
--- a/riscv/Makefile
+++ b/riscv/Makefile
@@ -64,13 +64,15 @@  define arch_elf_check =
 		$(error $(1) has unsupported reloc types))
 endef
 
-ISA_COMMON = mafdc_zicsr_zifencei_zihintpause
+ISA_COMMON = imac_zicsr_zifencei_zihintpause
 
 ifeq ($(ARCH),riscv64)
-CFLAGS += -march=rv64i$(ISA_COMMON)
-CFLAGS += -DCONFIG_64BIT
+CFLAGS  += -DCONFIG_64BIT
+CFLAGS  += -mabi=lp64 -march=rv64$(ISA_COMMON)
+LDFLAGS += -melf64lriscv
 else ifeq ($(ARCH),riscv32)
-CFLAGS += -march=rv32i$(ISA_COMMON)
+CFLAGS  += -mabi=ilp32 -march=rv32$(ISA_COMMON)
+LDFLAGS += -melf32lriscv
 endif
 CFLAGS += -DCONFIG_RELOC
 CFLAGS += -mcmodel=medany