diff mbox series

[kvm-unit-tests,v2,7/8] lib/linux/const.h: test for `__ASSEMBLER__` as well

Message ID 20230119114045.34553-8-mhartmay@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Some cleanup patches | expand

Commit Message

Marc Hartmayer Jan. 19, 2023, 11:40 a.m. UTC
On s390x we're using the preprocessor for generating our linker scripts
out of assembly files. The macro `__ASSEMBLER__` is defined with value 1
when preprocessing assembly language using gcc. [1] Therefore, let's
check for the macro `__ASSEMBLER__` in `lib/linux/const.h` as well. Thus
we can use macros that makes use of the `_AC` or `_AT` macro in the
"linker scripts".

[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Janosch Frank Jan. 31, 2023, 10:10 a.m. UTC | #1
On 1/19/23 12:40, Marc Hartmayer wrote:
> On s390x we're using the preprocessor for generating our linker scripts
> out of assembly files. The macro `__ASSEMBLER__` is defined with value 1
> when preprocessing assembly language using gcc. [1] Therefore, let's
> check for the macro `__ASSEMBLER__` in `lib/linux/const.h` as well. Thus
> we can use macros that makes use of the `_AC` or `_AT` macro in the
> "linker scripts".
> 
> [1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

TIL: the whole ASSEMBLY / ASSEMBLER problem is a rabbit hole in itself.

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>   lib/linux/const.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/linux/const.h b/lib/linux/const.h
> index c872bfd25e13..be114dc4a553 100644
> --- a/lib/linux/const.h
> +++ b/lib/linux/const.h
> @@ -12,7 +12,7 @@
>    * leave it unchanged in asm.
>    */
>   
> -#ifdef __ASSEMBLY__
> +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
>   #define _AC(X,Y)	X
>   #define _AT(T,X)	X
>   #else
diff mbox series

Patch

diff --git a/lib/linux/const.h b/lib/linux/const.h
index c872bfd25e13..be114dc4a553 100644
--- a/lib/linux/const.h
+++ b/lib/linux/const.h
@@ -12,7 +12,7 @@ 
  * leave it unchanged in asm.
  */
 
-#ifdef __ASSEMBLY__
+#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
 #define _AC(X,Y)	X
 #define _AT(T,X)	X
 #else