riscv: kexec: do not add '-mno-relax' flag if compiler doesn't support it
authorChangbin Du <changbin.du@gmail.com>
Thu, 22 Jul 2021 02:17:15 +0000 (10:17 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 12 Aug 2021 14:16:52 +0000 (07:16 -0700)
The RISC-V special option '-mno-relax' which to disable linker relaxations
is supported by GCC8+. For GCC7 and lower versions do not support this
option.

Fixes: fba8a8674f68 ("RISC-V: Add kexec support")
Signed-off-by: Changbin Du <changbin.du@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/Makefile

index d3081e4..3397dda 100644 (file)
@@ -11,7 +11,7 @@ endif
 CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,)
 
 ifdef CONFIG_KEXEC
-AFLAGS_kexec_relocate.o := -mcmodel=medany -mno-relax
+AFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax)
 endif
 
 extra-y += head.o