[PATCH v5 03/27] arm64/sysreg: Add LINKER_SCRIPT guards for sysreg.h

Mark Brown broonie at kernel.org
Wed Jun 22 10:43:52 PDT 2022


In subsequent patches sysreg.h and gpr-num.h will be included from other
headers which can be included from linker scripts (e.g. via cache.h), and
contain assember macro directives that don't work in linker scripts (e.g.
`.macro` and `.irp`).

To avoid needing LINKER_SCRIPT guards in every file which could have a
transitive dependency, add those directly to sysreg.h and gpr-num.h.

Signed-off-by: Mark Brown <broonie at kernel.org>
---
 arch/arm64/include/asm/gpr-num.h | 3 +++
 arch/arm64/include/asm/sysreg.h  | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm64/include/asm/gpr-num.h b/arch/arm64/include/asm/gpr-num.h
index 05da4a7c5788..72c44f63fb41 100644
--- a/arch/arm64/include/asm/gpr-num.h
+++ b/arch/arm64/include/asm/gpr-num.h
@@ -4,12 +4,15 @@
 
 #ifdef __ASSEMBLY__
 
+#ifndef LINKER_SCRIPT
+
 	.irp	num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30
 	.equ	.L__gpr_num_x\num, \num
 	.equ	.L__gpr_num_w\num, \num
 	.endr
 	.equ	.L__gpr_num_xzr, 31
 	.equ	.L__gpr_num_wzr, 31
+#endif /* !LINKER_SCRIPT */
 
 #else /* __ASSEMBLY__ */
 
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 42ff95dba6da..6c7be1a2114b 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -1219,6 +1219,7 @@
 
 #ifdef __ASSEMBLY__
 
+#ifndef LINKER_SCRIPT
 	.macro	mrs_s, rt, sreg
 	 __emit_inst(0xd5200000|(\sreg)|(.L__gpr_num_\rt))
 	.endm
@@ -1226,6 +1227,7 @@
 	.macro	msr_s, sreg, rt
 	__emit_inst(0xd5000000|(\sreg)|(.L__gpr_num_\rt))
 	.endm
+#endif /* !LINKER_SCRIPT */
 
 #else
 
-- 
2.30.2




More information about the linux-arm-kernel mailing list