diff mbox series

[1/2] export.h: remove defined(__KERNEL__)

Message ID 20190909105317.20473-1-yamada.masahiro@socionext.com (mailing list archive)
State New, archived
Headers show
Series [1/2] export.h: remove defined(__KERNEL__) | expand

Commit Message

Masahiro Yamada Sept. 9, 2019, 10:53 a.m. UTC
This line was touched by commit f235541699bc ("export.h: allow for
per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
not explain why.

CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 include/linux/export.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Pitre Sept. 9, 2019, 1:48 p.m. UTC | #1
On Mon, 9 Sep 2019, Masahiro Yamada wrote:

> This line was touched by commit f235541699bc ("export.h: allow for
> per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
> not explain why.
> 
> CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).

I'm pretty sure it was needed back then so not to interfere with users 
of this file. My fault for not documenting it.


Nicolas
Masahiro Yamada Sept. 9, 2019, 2:34 p.m. UTC | #2
Hi Nicolas,

On Mon, Sep 9, 2019 at 10:48 PM Nicolas Pitre <nico@fluxnic.net> wrote:
>
> On Mon, 9 Sep 2019, Masahiro Yamada wrote:
>
> > This line was touched by commit f235541699bc ("export.h: allow for
> > per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
> > not explain why.
> >
> > CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).
>
> I'm pretty sure it was needed back then so not to interfere with users
> of this file. My fault for not documenting it.

Hmm, I did not see a problem in my quick build test.

Do you remember which file was causing the problem?
Nicolas Pitre Sept. 9, 2019, 4:06 p.m. UTC | #3
On Mon, 9 Sep 2019, Masahiro Yamada wrote:

> Hi Nicolas,
> 
> On Mon, Sep 9, 2019 at 10:48 PM Nicolas Pitre <nico@fluxnic.net> wrote:
> >
> > On Mon, 9 Sep 2019, Masahiro Yamada wrote:
> >
> > > This line was touched by commit f235541699bc ("export.h: allow for
> > > per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
> > > not explain why.
> > >
> > > CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).
> >
> > I'm pretty sure it was needed back then so not to interfere with users
> > of this file. My fault for not documenting it.
> 
> Hmm, I did not see a problem in my quick build test.
> 
> Do you remember which file was causing the problem?

If you build commit 7ec925701f5f with CONFIG_TRIM_UNUSED_KSYMS=y and the 
defined(__KERNEL__) test removed then you'll get:

  HOSTCC  scripts/mod/modpost.o
In file included from scripts/mod/modpost.c:24:
scripts/mod/../../include/linux/export.h:81:10: fatal error: linux/kconfig.h: No such file or directory


Nicolas
Masahiro Yamada Sept. 10, 2019, 2:10 a.m. UTC | #4
On Tue, Sep 10, 2019 at 1:06 AM Nicolas Pitre <nico@fluxnic.net> wrote:
>
> On Mon, 9 Sep 2019, Masahiro Yamada wrote:
>
> > Hi Nicolas,
> >
> > On Mon, Sep 9, 2019 at 10:48 PM Nicolas Pitre <nico@fluxnic.net> wrote:
> > >
> > > On Mon, 9 Sep 2019, Masahiro Yamada wrote:
> > >
> > > > This line was touched by commit f235541699bc ("export.h: allow for
> > > > per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
> > > > not explain why.
> > > >
> > > > CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).
> > >
> > > I'm pretty sure it was needed back then so not to interfere with users
> > > of this file. My fault for not documenting it.
> >
> > Hmm, I did not see a problem in my quick build test.
> >
> > Do you remember which file was causing the problem?
>
> If you build commit 7ec925701f5f with CONFIG_TRIM_UNUSED_KSYMS=y and the
> defined(__KERNEL__) test removed then you'll get:
>
>   HOSTCC  scripts/mod/modpost.o
> In file included from scripts/mod/modpost.c:24:
> scripts/mod/../../include/linux/export.h:81:10: fatal error: linux/kconfig.h: No such file or directory
>
>
> Nicolas


Thanks for explaining this.

It is not the case any more.


I will reword the commit message as follows:

------------------------>8---------------------------------------
export.h: remove defined(__KERNEL__), which is no longer needed

The conditional define(__KERNEL__) was added by commit f235541699bc
("export.h: allow for per-symbol configurable EXPORT_SYMBOL()").

It was needed at that time to avoid the build error of modpost
with CONFIG_TRIM_UNUSED_KSYMS=y.

Since commit b2c5cdcfd4bc ("modpost: remove symbol prefix support"),
modpost no longer includes linux/export.h, thus the define(__KERNEL__)
is unneeded.
------------------------>8---------------------------------------



--
Best Regards
Masahiro Yamada
Nicolas Pitre Sept. 10, 2019, 2:21 a.m. UTC | #5
On Tue, 10 Sep 2019, Masahiro Yamada wrote:

> On Tue, Sep 10, 2019 at 1:06 AM Nicolas Pitre <nico@fluxnic.net> wrote:
> >
> > On Mon, 9 Sep 2019, Masahiro Yamada wrote:
> >
> > > Hi Nicolas,
> > >
> > > On Mon, Sep 9, 2019 at 10:48 PM Nicolas Pitre <nico@fluxnic.net> wrote:
> > > >
> > > > On Mon, 9 Sep 2019, Masahiro Yamada wrote:
> > > >
> > > > > This line was touched by commit f235541699bc ("export.h: allow for
> > > > > per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
> > > > > not explain why.
> > > > >
> > > > > CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).
> > > >
> > > > I'm pretty sure it was needed back then so not to interfere with users
> > > > of this file. My fault for not documenting it.
> > >
> > > Hmm, I did not see a problem in my quick build test.
> > >
> > > Do you remember which file was causing the problem?
> >
> > If you build commit 7ec925701f5f with CONFIG_TRIM_UNUSED_KSYMS=y and the
> > defined(__KERNEL__) test removed then you'll get:
> >
> >   HOSTCC  scripts/mod/modpost.o
> > In file included from scripts/mod/modpost.c:24:
> > scripts/mod/../../include/linux/export.h:81:10: fatal error: linux/kconfig.h: No such file or directory
> >
> >
> > Nicolas
> 
> 
> Thanks for explaining this.
> 
> It is not the case any more.
> 
> 
> I will reword the commit message as follows:
> 
> ------------------------>8---------------------------------------
> export.h: remove defined(__KERNEL__), which is no longer needed
> 
> The conditional define(__KERNEL__) was added by commit f235541699bc
> ("export.h: allow for per-symbol configurable EXPORT_SYMBOL()").
> 
> It was needed at that time to avoid the build error of modpost
> with CONFIG_TRIM_UNUSED_KSYMS=y.
> 
> Since commit b2c5cdcfd4bc ("modpost: remove symbol prefix support"),
> modpost no longer includes linux/export.h, thus the define(__KERNEL__)
> is unneeded.
> ------------------------>8---------------------------------------
> 

Acked-by: Nicolas Pitre <nico@fluxnic.net>


Nicolas
Masahiro Yamada Sept. 12, 2019, 11:48 a.m. UTC | #6
On Mon, Sep 9, 2019 at 7:53 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> This line was touched by commit f235541699bc ("export.h: allow for
> per-symbol configurable EXPORT_SYMBOL()"), but the commit log did
> not explain why.
>
> CONFIG_TRIM_UNUSED_KSYMS works for me without defined(__KERNEL__).
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Both applied to linux-kbuild.


>  include/linux/export.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/export.h b/include/linux/export.h
> index fd8711ed9ac4..cdd98a0d918c 100644
> --- a/include/linux/export.h
> +++ b/include/linux/export.h
> @@ -20,7 +20,7 @@ extern struct module __this_module;
>
>  #ifdef CONFIG_MODULES
>
> -#if defined(__KERNEL__) && !defined(__GENKSYMS__)
> +#if !defined(__GENKSYMS__)
>  #ifdef CONFIG_MODVERSIONS
>  /* Mark the CRC weak since genksyms apparently decides not to
>   * generate a checksums for some symbols */
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/include/linux/export.h b/include/linux/export.h
index fd8711ed9ac4..cdd98a0d918c 100644
--- a/include/linux/export.h
+++ b/include/linux/export.h
@@ -20,7 +20,7 @@  extern struct module __this_module;
 
 #ifdef CONFIG_MODULES
 
-#if defined(__KERNEL__) && !defined(__GENKSYMS__)
+#if !defined(__GENKSYMS__)
 #ifdef CONFIG_MODVERSIONS
 /* Mark the CRC weak since genksyms apparently decides not to
  * generate a checksums for some symbols */