mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2] module.h: split out the EXPORT_SYMBOL into export.h
Date: Tue, 12 May 2020 07:39:52 +0200	[thread overview]
Message-ID: <20200512053952.GV5877@pengutronix.de> (raw)
In-Reply-To: <20200509031133.836743-1-masahiroy@kernel.org>

On Sat, May 09, 2020 at 12:11:33PM +0900, Masahiro Yamada wrote:
> Do as Linux commit f50169324df4ad942e544386d136216c8617636a
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
> Changes in v2:
>   - move THIS_MODULE

Applied, thanks

Sascha

> 
>  include/linux/export.h | 39 +++++++++++++++++++++++++++++++++++++++
>  include/module.h       | 28 +---------------------------
>  2 files changed, 40 insertions(+), 27 deletions(-)
>  create mode 100644 include/linux/export.h
> 
> diff --git a/include/linux/export.h b/include/linux/export.h
> new file mode 100644
> index 000000000..88d318bd8
> --- /dev/null
> +++ b/include/linux/export.h
> @@ -0,0 +1,39 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef _LINUX_EXPORT_H
> +#define _LINUX_EXPORT_H
> +
> +#define THIS_MODULE	0
> +
> +#ifdef CONFIG_MODULES
> +
> +struct kernel_symbol
> +{
> +	unsigned long value;
> +	const char *name;
> +};
> +
> +/* For every exported symbol, place a struct in the __ksymtab section */
> +#define __EXPORT_SYMBOL(sym, sec)				\
> +	extern typeof(sym) sym;					\
> +	static const char __ustrtab_##sym[]			\
> +	__attribute__((section("__usymtab_strings")))		\
> +	= MODULE_SYMBOL_PREFIX #sym;                    	\
> +	static const struct kernel_symbol __usymtab_##sym	\
> +	__used \
> +	__attribute__((section("__usymtab" sec), unused))	\
> +	= { (unsigned long)&sym, __ustrtab_##sym }
> +
> +#define EXPORT_SYMBOL(sym)					\
> +	__EXPORT_SYMBOL(sym, "")
> +
> +#define EXPORT_SYMBOL_GPL(sym)					\
> +	__EXPORT_SYMBOL(sym, "")
> +
> +#else
> +
> +#define EXPORT_SYMBOL(sym)
> +#define EXPORT_SYMBOL_GPL(sym)
> +
> +#endif /* CONFIG_MODULES */
> +
> +#endif /* _LINUX_EXPORT_H */
> diff --git a/include/module.h b/include/module.h
> index abf740a78..cea8c2e18 100644
> --- a/include/module.h
> +++ b/include/module.h
> @@ -4,6 +4,7 @@
>  
>  #include <elf.h>
>  #include <linux/compiler.h>
> +#include <linux/export.h>
>  #include <linux/list.h>
>  
>  #ifndef MODULE_SYMBOL_PREFIX
> @@ -11,36 +12,12 @@
>  #endif
>  
>  #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
> -#define THIS_MODULE	0
>  
>  #ifdef CONFIG_MODULES
>  #include <asm/module.h>
>  
> -struct kernel_symbol
> -{
> -	unsigned long value;
> -	const char *name;
> -};
> -
>  struct module * load_module(void *mod_image, unsigned long len);
>  
> -/* For every exported symbol, place a struct in the __ksymtab section */
> -#define __EXPORT_SYMBOL(sym, sec)				\
> -	extern typeof(sym) sym;					\
> -	static const char __ustrtab_##sym[]			\
> -	__attribute__((section("__usymtab_strings")))		\
> -	= MODULE_SYMBOL_PREFIX #sym;                    	\
> -	static const struct kernel_symbol __usymtab_##sym	\
> -	__used \
> -	__attribute__((section("__usymtab" sec), unused))	\
> -	= { (unsigned long)&sym, __ustrtab_##sym }
> -
> -#define EXPORT_SYMBOL(sym)					\
> -	__EXPORT_SYMBOL(sym, "")
> -
> -#define EXPORT_SYMBOL_GPL(sym)					\
> -	__EXPORT_SYMBOL(sym, "")
> -
>  struct module {
>  	/* Unique handle for this module */
>  	char name[MODULE_NAME_LEN];
> @@ -74,9 +51,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
>  		       unsigned int symindex,
>  		       unsigned int relsec,
>  		       struct module *mod);
> -#else
> -#define EXPORT_SYMBOL(sym)
> -#define EXPORT_SYMBOL_GPL(sym)
>  #endif /* CONFIG_MODULES */
>  
>  extern struct list_head module_list;
> -- 
> 2.25.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2020-05-12  5:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  3:11 Masahiro Yamada
2020-05-12  5:39 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512053952.GV5877@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=masahiroy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox