[PATCH] RISC-V: Guard alternative asm macros with !LINKER_SCRIPT

Palmer Dabbelt palmer at rivosinc.com
Tue Feb 14 12:13:58 PST 2023


Without this I get a handful of .macro related directives that trip up
LD.

Signed-off-by: Palmer Dabbelt <palmer at rivosinc.com>
---
I'm not sure when this started failing, but I recently tried a build on
my local machine (with crossdev-based toolchains) and it failed.
---
 arch/riscv/include/asm/alternative-macros.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/include/asm/alternative-macros.h b/arch/riscv/include/asm/alternative-macros.h
index cc6a81c00f2f..afc87528cf71 100644
--- a/arch/riscv/include/asm/alternative-macros.h
+++ b/arch/riscv/include/asm/alternative-macros.h
@@ -6,6 +6,8 @@
 
 #ifdef __ASSEMBLY__
 
+#ifndef LINKER_SCRIPT
+
 .macro ALT_ENTRY oldptr newptr vendor_id errata_id new_len
 	.4byte \oldptr - .
 	.4byte \newptr - .
@@ -53,6 +55,8 @@
 #define __ALTERNATIVE_CFG(...)		ALTERNATIVE_CFG __VA_ARGS__
 #define __ALTERNATIVE_CFG_2(...)	ALTERNATIVE_CFG_2 __VA_ARGS__
 
+#endif /* LINKER_SCRIPT */
+
 #else /* !__ASSEMBLY__ */
 
 #include <asm/asm.h>
-- 
2.39.0




More information about the linux-riscv mailing list