grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 5/5] loongarch: Use the -mno-relax cflags for gcc


From: Daniel Kiper
Subject: Re: [PATCH v3 5/5] loongarch: Use the -mno-relax cflags for gcc
Date: Tue, 13 Jun 2023 13:39:32 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Jun 13, 2023 at 05:06:35PM +0800, Xiaotian Wu wrote:
> Because the binutils of the loongarch architecture adds relaxation support 
> [1],
> the next version of binutils will not be able to build grub.
>
> So we use the -mno-relax cflags to disable gcc to generate relaxation
> relocations to enhance the compatibility of grub.
>
> [1]: 
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=56576f4a722b7398d35802ecf7d4185c27d6d69b
>
> Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
> ---
>  configure.ac | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index d9f088d12..cd3cc6ba8 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -874,6 +874,18 @@ if test "x$target_cpu" = xloongarch64; then
>      TARGET_CFLAGS="$TARGET_CFLAGS -mno-explicit-relocs -fno-plt"
>      TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mno-explicit-relocs -fno-plt"
>    fi
> +
> +  AC_CACHE_CHECK([whether _mno_relax works], [grub_cv_cc_mno_relax], [
> +    CFLAGS="$TARGET_CFLAGS -mno-relax -Werror"
> +    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
> +     [grub_cv_cc_mno_relax=yes],
> +     [grub_cv_cc_mno_relax=no])
> +  ])
> +  if test "x$grub_cv_cc_mno_relax" = xyes; then
> +    TARGET_CFLAGS="$TARGET_CFLAGS -mno-relax"
> +    TARGET_CCASFLAGS="$TARGET_CCASFLAGS -mno-relax"
> +  fi

Could not you reuse sparc64 code which is ~100 lines below? If not
please make loongarch code as similar as possible to the sparc64 one.

Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]