On Sat, Jan 20, 2024 at 01:14:04AM +0100, kleines Filmröllchen wrote:

> 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

We don't have hard and fast rules about adding copyright lines, but this
seems a bit excessive.

> @@ -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

A quick check shows that GCC support -ffixed-x3 as well, so we should
just use that in all cases.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to