diff mbox series

[5/7] kbuild: hide CONFIG_TRIM_UNUSED_KSYMS code from external module building

Message ID 1521045861-22418-6-git-send-email-yamada.masahiro@socionext.com
State Superseded
Headers show
Series kbuild: various fix, clean-up, improvements of CONFIG_TRIM_UNUSED_KSYMS | expand

Commit Message

Masahiro Yamada March 14, 2018, 4:44 p.m. UTC
If CONFIG_TRIM_UNUSED_KYMS is enabled, KBUILD_MODULES is set.  This
code is unneeded for external module building because KBUILD_MODULES
is always set.  Move this code inside "ifeq ($(KBUILD_EXTMOD),)"
conditional.

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

---

 Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.7.4

Comments

Nicolas Pitre March 14, 2018, 6:32 p.m. UTC | #1
On Thu, 15 Mar 2018, Masahiro Yamada wrote:

> If CONFIG_TRIM_UNUSED_KYMS is enabled, KBUILD_MODULES is set.  


Not when you do "make vmlinux" though.

> This code is unneeded for external module building because 

> KBUILD_MODULES is always set.  Move this code inside "ifeq 

> ($(KBUILD_EXTMOD),)" conditional.

> 

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


Acked-by: Nicolas Pitre <nico@linaro.org>


> ---

> 

>  Makefile | 14 +++++++-------

>  1 file changed, 7 insertions(+), 7 deletions(-)

> 

> diff --git a/Makefile b/Makefile

> index decc870..e60b16f 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -603,13 +603,6 @@ else

>  include/config/auto.conf: ;

>  endif # $(dot-config)

>  

> -# For the kernel to actually contain only the needed exported symbols,

> -# we have to build modules as well to determine what those symbols are.

> -# (this can be evaluated only once include/config/auto.conf has been included)

> -ifdef CONFIG_TRIM_UNUSED_KSYMS

> -  KBUILD_MODULES := 1

> -endif

> -

>  # The all: target is the default when no target is given on the

>  # command line.

>  # This allow a user to issue only 'make' to build a kernel including modules

> @@ -1010,6 +1003,13 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS

>  	  "$(MAKE) -f $(srctree)/Makefile vmlinux"

>  endif

>  

> +# For the kernel to actually contain only the needed exported symbols,

> A+# we have to build modules as well to determine what those symbols 

are.
> +# (this can be evaluated only once include/config/auto.conf has been included)

> +ifdef CONFIG_TRIM_UNUSED_KSYMS

> +  KBUILD_MODULES := 1

> +endif

> +

>  autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)

>  

>  $(autoksyms_h):

> -- 

> 2.7.4

> 

>
Masahiro Yamada March 15, 2018, 6:36 a.m. UTC | #2
2018-03-15 3:32 GMT+09:00 Nicolas Pitre <nicolas.pitre@linaro.org>:
> On Thu, 15 Mar 2018, Masahiro Yamada wrote:

>

>> If CONFIG_TRIM_UNUSED_KYMS is enabled, KBUILD_MODULES is set.

>

> Not when you do "make vmlinux" though.


I could not understand this.

Unless I am missing something,
I think this code is always parsed.



>> This code is unneeded for external module building because

>> KBUILD_MODULES is always set.  Move this code inside "ifeq

>> ($(KBUILD_EXTMOD),)" conditional.

>>

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

>

> Acked-by: Nicolas Pitre <nico@linaro.org>

>

>> ---

>>

>>  Makefile | 14 +++++++-------

>>  1 file changed, 7 insertions(+), 7 deletions(-)

>>

>> diff --git a/Makefile b/Makefile

>> index decc870..e60b16f 100644

>> --- a/Makefile

>> +++ b/Makefile

>> @@ -603,13 +603,6 @@ else

>>  include/config/auto.conf: ;

>>  endif # $(dot-config)

>>

>> -# For the kernel to actually contain only the needed exported symbols,

>> -# we have to build modules as well to determine what those symbols are.

>> -# (this can be evaluated only once include/config/auto.conf has been included)

>> -ifdef CONFIG_TRIM_UNUSED_KSYMS

>> -  KBUILD_MODULES := 1

>> -endif

>> -

>>  # The all: target is the default when no target is given on the

>>  # command line.

>>  # This allow a user to issue only 'make' to build a kernel including modules

>> @@ -1010,6 +1003,13 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS

>>         "$(MAKE) -f $(srctree)/Makefile vmlinux"

>>  endif

>>

>> +# For the kernel to actually contain only the needed exported symbols,

>> A+# we have to build modules as well to determine what those symbols

> are.

>> +# (this can be evaluated only once include/config/auto.conf has been included)

>> +ifdef CONFIG_TRIM_UNUSED_KSYMS

>> +  KBUILD_MODULES := 1

>> +endif

>> +

>>  autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)

>>

>>  $(autoksyms_h):

>> --

>> 2.7.4

>>

>>




-- 
Best Regards
Masahiro Yamada
Nicolas Pitre March 15, 2018, 6:30 p.m. UTC | #3
On Thu, 15 Mar 2018, Masahiro Yamada wrote:

> 2018-03-15 3:32 GMT+09:00 Nicolas Pitre <nicolas.pitre@linaro.org>:

> > On Thu, 15 Mar 2018, Masahiro Yamada wrote:

> >

> >> If CONFIG_TRIM_UNUSED_KYMS is enabled, KBUILD_MODULES is set.

> >

> > Not when you do "make vmlinux" though.

> 

> I could not understand this.

> 

> Unless I am missing something,

> I think this code is always parsed.


Sorry, you're right. I had misread your sentence when I replied.


Nicolas
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index decc870..e60b16f 100644
--- a/Makefile
+++ b/Makefile
@@ -603,13 +603,6 @@  else
 include/config/auto.conf: ;
 endif # $(dot-config)
 
-# For the kernel to actually contain only the needed exported symbols,
-# we have to build modules as well to determine what those symbols are.
-# (this can be evaluated only once include/config/auto.conf has been included)
-ifdef CONFIG_TRIM_UNUSED_KSYMS
-  KBUILD_MODULES := 1
-endif
-
 # The all: target is the default when no target is given on the
 # command line.
 # This allow a user to issue only 'make' to build a kernel including modules
@@ -1010,6 +1003,13 @@  ifdef CONFIG_TRIM_UNUSED_KSYMS
 	  "$(MAKE) -f $(srctree)/Makefile vmlinux"
 endif
 
+# For the kernel to actually contain only the needed exported symbols,
+# we have to build modules as well to determine what those symbols are.
+# (this can be evaluated only once include/config/auto.conf has been included)
+ifdef CONFIG_TRIM_UNUSED_KSYMS
+  KBUILD_MODULES := 1
+endif
+
 autoksyms_h := $(if $(CONFIG_TRIM_UNUSED_KSYMS), include/generated/autoksyms.h)
 
 $(autoksyms_h):