[PATCH v2 3/7] include: sync <linux/linkage.h> with Linux

Sascha Hauer sha at pengutronix.de
Thu May 25 23:54:36 PDT 2023


On Fri, May 26, 2023 at 08:37:42AM +0200, Ahmad Fatoum wrote:
> Linux has added new SYM_ macros in the assembly code and deprecated
> ENTRY/PROC. Import the necessary definitions to make kernel code
> porting easier.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  common/Kconfig          |   6 +
>  include/linux/linkage.h | 321 ++++++++++++++++++++++++++++++++++++----
>  2 files changed, 298 insertions(+), 29 deletions(-)
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index ce94718c848a..5346ba5a623c 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1710,3 +1710,9 @@ config DDR_SPD
>  
>  config HAVE_ARCH_ASAN
>  	bool
> +
> +config ARCH_USE_SYM_ANNOTATIONS
> +	bool
> +	help
> +	  This is selected by architectures that exclusively use the new SYM_
> +	  macros in their assembly code and not the deprecated ENTRY/PROC.
> diff --git a/include/linux/linkage.h b/include/linux/linkage.h
> index efb2d6fa407b..c262c7b36907 100644
> --- a/include/linux/linkage.h
> +++ b/include/linux/linkage.h
> @@ -3,9 +3,16 @@
>  #ifndef _LINUX_LINKAGE_H
>  #define _LINUX_LINKAGE_H
>  
> -#include <linux/compiler.h>
> +#include <linux/compiler_types.h>
> +#include <linux/stringify.h>
> +#include <linux/export.h>

This breaks compilation zylonite310_defconfig. include/linux/export.h is
not safe for being included from assembly files when CONFIG_MODULES is
enabled. We could drop this inclusion here as linux/export.h doesn't
contain anything useful for assembly code. However, I added the
following instead to not trap into this again should linux/linkage.h
be updated again.

Sascha

>From 36b3448b724db0ed1888d61de7069df0ebcfcdc1 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer at pengutronix.de>
Date: Fri, 26 May 2023 08:48:55 +0200
Subject: [PATCH] include: make linux/export.h safe for being included from
 assembly

include/linux/linkage.h is included from assembly files and itself
includes linux/export.h, so add #ifndef __ASSEMBLY__ protection
to that file as well.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/linux/export.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/export.h b/include/linux/export.h
index 88d318bd8a..90f6ada2d5 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -2,6 +2,8 @@
 #ifndef _LINUX_EXPORT_H
 #define _LINUX_EXPORT_H
 
+#ifndef __ASSEMBLY__
+
 #define THIS_MODULE	0
 
 #ifdef CONFIG_MODULES
@@ -36,4 +38,6 @@ struct kernel_symbol
 
 #endif /* CONFIG_MODULES */
 
+#endif /* __ASSEMBLY__ */
+
 #endif /* _LINUX_EXPORT_H */
-- 
2.39.2

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list