s390: Guard emitting assembler macros for insn-common-asm.h
PATCH v2 1/1 s390: Guard emitting assembler macros for insn-common-asm.h
The CPP include guard of insn-common-asm.h is ineffective when the file is read via a gas-level .include from inline asm. The assembler ignores all '#' lines, so every .include redefines GR_NUM/VX_NUM and fails with "Macro was already defined" if a translation unit emits more than one such include. This is not the case right now but may lead to future build issues.
Add a header 'asm/insn-common-asm-emit.h' that can be used by C/H files which want to emit those macros. The header guards the GAS include to prevent multiple includes in one compilation unit.
---
Changes in v2:
- Use a separate -emit header and CPP Guards to guard the asm .include. (Andreas)
- Link to v1: https://lore.kernel.org/r/[email protected]
--- arch/s390/include/asm/fpu-insn.h | 2 +- arch/s390/include/asm/insn-common-asm-emit.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
arch/s390/include/asm/fpu-insn.h +1 -1
@@ -14,8 +14,8 @@#include <linux/instrumented.h> #include <linux/kmsan.h> #include <asm/asm-extable.h> +#include <asm/insn-common-asm-emit.h> -asm(".include \"asm/insn-common-asm.h\"\n" ); asm(".include \"asm/fpu-insn-asm.h\"\n" );/*
arch/s390/include/asm/insn-common-asm-emit.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __ASM_S390_INSN_COMMON_ASM_EMIT_H +#define __ASM_S390_INSN_COMMON_ASM_EMIT_H + +asm(".include \"asm/insn-common-asm.h\"\n" ); + +#endif /* __ASM_S390_INSN_COMMON_ASM_EMIT_H */
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 7 lines
The CPP include guard of
insn-common-asm.his ineffective when the file is read via a gas-level .include from inline asm. The assembler ignores all '#' lines, so every .include redefines GR_NUM/VX_NUM and fails with "Macro was already defined" if a translation unit emits more than one such include. This is not the case right now but may lead to future build issues.
Quoted 7 lines
Add a header '
asm/insn-common-asm-emit.h' that can be used by C/H files which want to emit those macros. The header guards the GAS include to prevent multiple includes in one compilation unit.Co-developed-by Andreas Grapentin <[email protected]>Signed-off-by Andreas Grapentin <[email protected]>Signed-off-by Steffen Eiden <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 44 lines · Steffen Eiden
The CPP include guard of
insn-common-asm.his ineffective when the file is read via a gas-level .include from inline asm. The assembler ignores all '#' lines, so every .include redefines GR_NUM/VX_NUM and fails with "Macro was already defined" if a translation unit emits more than one such include. This is not the case right now but may lead to future build issues.Add a header '
asm/insn-common-asm-emit.h' that can be used by C/H files which want to emit those macros. The header guards the GAS include to prevent multiple includes in one compilation unit.Co-developed-by Andreas Grapentin <[email protected]>Signed-off-by Andreas Grapentin <[email protected]>Signed-off-by Steffen Eiden <[email protected]>---
Changes in v2:
- Use a separate -emit header and CPP Guards to guard the asm .include. (Andreas)
- Link to v1: https://lore.kernel.org/r/[email protected]--- arch/s390/include/asm/fpu-insn.h | 2 +- arch/s390/include/asm/insn-common-asm-emit.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)arch/s390/include/asm/fpu-insn.h +1
-1@@ -14,8 +14,8 @@#include <linux/instrumented.h> #include <linux/kmsan.h> #include <asm/asm-extable.h> +#include <asm/insn-common-asm-emit.h> -asm(".include \"asm/insn-common-asm.h\"\n" ); asm(".include \"asm/fpu-insn-asm.h\"\n" );/* arch/s390/include/asm/insn-common-asm-emit.h new file +0
-0
arch/s390/include/asm/insn-common-asm-emit.h line 8
Quoted 8 lines
arch/s390/include/asm/insn-common-asm-emit.h new file +8
-0@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __ASM_S390_INSN_COMMON_ASM_EMIT_H +#define __ASM_S390_INSN_COMMON_ASM_EMIT_H + +asm(".include \"asm/insn-common-asm.h\"\n" ); + +#endif /* __ASM_S390_INSN_COMMON_ASM_EMIT_H */
Am 05.11.26 um 14:46 schrieb Steffen Eiden:
Quoted 11 lines
The CPP include guard of
insn-common-asm.his ineffective when the file is read via a gas-level .include from inline asm. The assembler ignores all '#' lines, so every .include redefines GR_NUM/VX_NUM and fails with "Macro was already defined" if a translation unit emits more than one such include. This is not the case right now but may lead to future build issues.Add a header '
asm/insn-common-asm-emit.h' that can be used by C/H files which want to emit those macros. The header guards the GAS include to prevent multiple includes in one compilation unit.
Quoted 8 lines
Co-developed-by Andreas Grapentin <[email protected]>Signed-off-by Andreas Grapentin <[email protected]>Signed-off-by Steffen Eiden <[email protected]>---
Changes in v2:
- Use a separate -emit header and CPP Guards to guard the asm .include. (Andreas)
- Link to v1: https://lore.kernel.org/r/[email protected]
Thanks applied.
As we need this for the 2nd series of the arm on s390 support I will take it via the kvms390 tree and queue it for kvms390/next as the first patch on top of 7.4-rc2. So if we ever have a (unlikely) complex conflict we can create a topic branch pointing to that commit at any time.
Quoted 33 lines
--- arch/s390/include/asm/fpu-insn.h | 2 +- arch/s390/include/asm/insn-common-asm-emit.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-)arch/s390/include/asm/fpu-insn.h +1
-1@@ -14,8 +14,8 @@#include <linux/instrumented.h> #include <linux/kmsan.h> #include <asm/asm-extable.h> +#include <asm/insn-common-asm-emit.h> -asm(".include \"asm/insn-common-asm.h\"\n" ); asm(".include \"asm/fpu-insn-asm.h\"\n" );/* arch/s390/include/asm/insn-common-asm-emit.h new file +8
-0@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __ASM_S390_INSN_COMMON_ASM_EMIT_H +#define __ASM_S390_INSN_COMMON_ASM_EMIT_H + +asm(".include \"asm/insn-common-asm.h\"\n" ); + +#endif /* __ASM_S390_INSN_COMMON_ASM_EMIT_H */