Skip to contentSkip to conversation

riscv: kexec: do not add '-mno-relax' flag if compiler doesn't support it

PATCH In review Changbin Du 2 participants 3 messages Jul 22, 2021 – Aug 12, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 riscv: kexec: do not add '-mno-relax' flag if compiler doesn't support it

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 fba8a8674f ("RISC-V: Add kexec support")
---
 arch/riscv/kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/Makefile +1 -1
index d3081e4d9600..3397ddac1a30 100644
@@ -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
Signature · 1 line
2.26.2
#1 lore raw

Hello, ping status for this fix. There's a build error with gcc7-.

Quoted 27 lines · Changbin Du

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 fba8a8674f ("RISC-V: Add kexec support")
---
 arch/riscv/kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/Makefile +1 -1
index d3081e4d9600..3397ddac1a30 100644
@@ -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
Signature · 1 line
2.26.2
Signature · 2 lines
Cheers,
Changbin Du
maintainer
#2 lore raw
In reply to Changbin Du
Quoted 3 lines · On Wed, 21 Jul 2021 19:17:15 PDT (-0700), [email protected] wrote:

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.

I would not trust GCC 7 on RISC-V, that was a long time ago and there's been a lot fixed since then.

Quoted 12 lines
Fixes fba8a8674f ("RISC-V: Add kexec support")
---
 arch/riscv/kernel/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/Makefile +0 -0
index d3081e4d9600..3397ddac1a30 100644

arch/riscv/kernel/Makefile endif · line 17

Quoted 8 lines
arch/riscv/kernel/Makefile +1 -1
@@ -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

This is on fixes.

Thanks!