The -ffixed-gp option of GCC has an exact equivalent of -ffixed-x3 in Clang.
Signed-off-by: kleines Filmröllchen <filmroellc...@serenityos.org> --- arch/riscv/config.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk index 9cf2aef0a4..dc4f30d673 100644 --- a/arch/riscv/config.mk +++ b/arch/riscv/config.mk @@ -9,6 +9,9 @@ # Copyright (C) 2017 Andes Technology Corporation # Rick Chen, Andes Technology Corporation <r...@andestech.com> # +# Copyright (C) 2024 the SerenityOS project +# kleines Filmröllchen <filmroellc...@serenityos.org> +# 32bit-emul := elf32lriscv 64bit-emul := elf64lriscv @@ -25,7 +28,12 @@ EFI_LDS := elf_riscv64_efi.lds PLATFORM_ELFFLAGS += -B riscv -O elf64-littleriscv endif -PLATFORM_CPPFLAGS += -ffixed-gp -fpic +PLATFORM_CPPFLAGS += -fpic +ifeq ($(cc-name),clang) +PLATFORM_CPPFLAGS += -ffixed-x3 +else +PLATFORM_CPPFLAGS += -ffixed-gp +endif PLATFORM_RELFLAGS += -fno-common -ffunction-sections -fdata-sections LDFLAGS_u-boot += --gc-sections -static -pie -- 2.39.2