From 82ea6d6a57a9c007e6b61528c440175c39f472d2 Mon Sep 17 00:00:00 2001 From: xvanc Date: Thu, 3 Aug 2023 03:46:46 -0500 Subject: [PATCH] test/riscv: disable linker relaxation, specify ISA string and ABI Although linker relaxation is disabled, the compiler still emits small data sections which must be explicitly included in the linker script. --- test/GNUmakefile | 5 +++++ test/linker.ld | 2 ++ 2 files changed, 7 insertions(+) diff --git a/test/GNUmakefile b/test/GNUmakefile index 8f3329a3..53c9b448 100644 --- a/test/GNUmakefile +++ b/test/GNUmakefile @@ -47,6 +47,11 @@ override INTERNALCFLAGS := \ -I. \ -I.. +ifneq ($(findstring riscv,$(CC_FOR_TARGET)),) +override INTERNALCFLAGS += -march=rv64imac -mabi=lp64 -mno-relax +override INTERNALLDFLAGS += --no-relax +endif + override INTERNALCFLAGS_MB := \ -std=c11 \ -ffreestanding \ diff --git a/test/linker.ld b/test/linker.ld index ce95d7f3..a3cae318 100644 --- a/test/linker.ld +++ b/test/linker.ld @@ -32,6 +32,7 @@ SECTIONS .data : { *(.data .data.*) + *(.sdata .sdata.*) } :data .dynamic : { @@ -39,6 +40,7 @@ SECTIONS } :data :dynamic .bss : { + *(.sbss .sbss.*) *(.bss .bss.*) *(COMMON) } :data