Re: [PATCH 1/2] kbuild: remove top-level built-in.a

2019-01-23 Thread Nicholas Piggin
Masahiro Yamada's on January 15, 2019 7:01 pm:
> Hi Nicholas,
> 
> 
> On Tue, Jan 15, 2019 at 5:07 PM Nicholas Piggin  wrote:
>>
>> Masahiro Yamada's on January 14, 2019 1:27 pm:
>> > The symbol table in the final archive is unneeded because it is passed
>> > to the linker after the --whole-archive option. Every object file in
>> > the archive is included in the link anyway.
>> >
>> > Pass thin archives from subdirectories directly to the linker, and
>> > remove the final archiving step.
>>
>> This seems like a good improvement. As far as I remember, it was slower
>> to do the final link without the index built. Maybe I was testing it
>> in a revision before moving those files into --whole-archive? If there
>> is no slowdown, then I have no objection.
> 
> 
> Thanks for the review.
> 
> 
> I measured the performance of scripts/link-vmlinux.sh with 'perf stat'.
> (20 times for each)
> 
> 
> 
> Before this patch:
> 
>  Performance counter stats for 'make vmlinux' (20 runs):
> 
>5.266796537 seconds time elapsed
>   ( +-  0.12% )
> 
> 
> 
> After this patch:
> 
>  Performance counter stats for 'make vmlinux' (20 runs):
> 
>4.945576395 seconds time elapsed
> 
> 
> 
> 
> So, the performance is slightly better.
> 
> Maybe, does omitting the 'ar' save some time?

Wow yeah that's a good speedup and simplification to boot. Thanks for 
checking it.

> Anyway, this commit is good.

Yes, it's a good improvement.

Thanks,
Nick


Re: [PATCH 1/2] kbuild: remove top-level built-in.a

2019-01-15 Thread Masahiro Yamada
Hi Nicholas,


On Tue, Jan 15, 2019 at 5:07 PM Nicholas Piggin  wrote:
>
> Masahiro Yamada's on January 14, 2019 1:27 pm:
> > The symbol table in the final archive is unneeded because it is passed
> > to the linker after the --whole-archive option. Every object file in
> > the archive is included in the link anyway.
> >
> > Pass thin archives from subdirectories directly to the linker, and
> > remove the final archiving step.
>
> This seems like a good improvement. As far as I remember, it was slower
> to do the final link without the index built. Maybe I was testing it
> in a revision before moving those files into --whole-archive? If there
> is no slowdown, then I have no objection.


Thanks for the review.


I measured the performance of scripts/link-vmlinux.sh with 'perf stat'.
(20 times for each)



Before this patch:

 Performance counter stats for 'make vmlinux' (20 runs):

   5.266796537 seconds time elapsed
  ( +-  0.12% )



After this patch:

 Performance counter stats for 'make vmlinux' (20 runs):

   4.945576395 seconds time elapsed




So, the performance is slightly better.

Maybe, does omitting the 'ar' save some time?


Anyway, this commit is good.


-- 
Best Regards
Masahiro Yamada


Re: [PATCH 1/2] kbuild: remove top-level built-in.a

2019-01-14 Thread Nicholas Piggin
Masahiro Yamada's on January 14, 2019 1:27 pm:
> The symbol table in the final archive is unneeded because it is passed
> to the linker after the --whole-archive option. Every object file in
> the archive is included in the link anyway.
> 
> Pass thin archives from subdirectories directly to the linker, and
> remove the final archiving step.

This seems like a good improvement. As far as I remember, it was slower 
to do the final link without the index built. Maybe I was testing it 
in a revision before moving those files into --whole-archive? If there
is no slowdown, then I have no objection.

Acked-by: Nicholas Piggin 


[PATCH 1/2] kbuild: remove top-level built-in.a

2019-01-13 Thread Masahiro Yamada
The symbol table in the final archive is unneeded because it is passed
to the linker after the --whole-archive option. Every object file in
the archive is included in the link anyway.

Pass thin archives from subdirectories directly to the linker, and
remove the final archiving step.

Signed-off-by: Masahiro Yamada 
---

 scripts/link-vmlinux.sh | 30 ++
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index c8cf453..4788def 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -44,24 +44,6 @@ info()
fi
 }
 
-# Thin archive build here makes a final archive with symbol table and indexes
-# from vmlinux objects INIT and MAIN, which can be used as input to linker.
-# KBUILD_VMLINUX_LIBS archives should already have symbol table and indexes
-# added.
-#
-# Traditional incremental style of link does not require this step
-#
-# built-in.a output file
-#
-archive_builtin()
-{
-   info AR built-in.a
-   rm -f built-in.a;
-   ${AR} rcsTP${KBUILD_ARFLAGS} built-in.a \
-   ${KBUILD_VMLINUX_INIT}  \
-   ${KBUILD_VMLINUX_MAIN}
-}
-
 # Link of vmlinux.o used for section mismatch analysis
 # ${1} output file
 modpost_link()
@@ -69,7 +51,8 @@ modpost_link()
local objects
 
objects="--whole-archive\
-   built-in.a  \
+   ${KBUILD_VMLINUX_INIT}  \
+   ${KBUILD_VMLINUX_MAIN}  \
--no-whole-archive  \
--start-group   \
${KBUILD_VMLINUX_LIBS}  \
@@ -88,7 +71,8 @@ vmlinux_link()
 
if [ "${SRCARCH}" != "um" ]; then
objects="--whole-archive\
-   built-in.a  \
+   ${KBUILD_VMLINUX_INIT}  \
+   ${KBUILD_VMLINUX_MAIN}  \
--no-whole-archive  \
--start-group   \
${KBUILD_VMLINUX_LIBS}  \
@@ -99,7 +83,8 @@ vmlinux_link()
-T ${lds} ${objects}
else
objects="-Wl,--whole-archive\
-   built-in.a  \
+   ${KBUILD_VMLINUX_INIT}  \
+   ${KBUILD_VMLINUX_MAIN}  \
-Wl,--no-whole-archive  \
-Wl,--start-group   \
${KBUILD_VMLINUX_LIBS}  \
@@ -160,7 +145,6 @@ cleanup()
rm -f .tmp_System.map
rm -f .tmp_kallsyms*
rm -f .tmp_vmlinux*
-   rm -f built-in.a
rm -f System.map
rm -f vmlinux
rm -f vmlinux.o
@@ -217,8 +201,6 @@ fi;
 # final build of init/
 ${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init
 
-archive_builtin
-
 #link vmlinux.o
 info LD vmlinux.o
 modpost_link vmlinux.o
-- 
2.7.4