Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-19 Thread Arnd Bergmann
On Fri, Mar 19, 2021 at 1:25 PM Catalin Marinas wrote: > On Thu, Mar 18, 2021 at 09:41:54AM +0100, Arnd Bergmann wrote: > > On Wed, Mar 17, 2021 at 5:18 PM Catalin Marinas > > wrote: > > > On Wed, Mar 17, 2021 at 02:37:57PM +, Catalin Marinas wrote: > > > > On Thu, Feb 25, 2021 at

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-19 Thread Catalin Marinas
On Thu, Mar 18, 2021 at 09:41:54AM +0100, Arnd Bergmann wrote: > On Wed, Mar 17, 2021 at 5:18 PM Catalin Marinas > wrote: > > > > On Wed, Mar 17, 2021 at 02:37:57PM +, Catalin Marinas wrote: > > > On Thu, Feb 25, 2021 at 12:20:56PM +0100, Arnd Bergmann wrote: > > > > diff --git

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-18 Thread Arnd Bergmann
On Wed, Mar 17, 2021 at 5:18 PM Catalin Marinas wrote: > > On Wed, Mar 17, 2021 at 02:37:57PM +, Catalin Marinas wrote: > > On Thu, Feb 25, 2021 at 12:20:56PM +0100, Arnd Bergmann wrote: > > > diff --git a/arch/arm64/kernel/vmlinux.lds.S > > > b/arch/arm64/kernel/vmlinux.lds.S > > > index

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-17 Thread Catalin Marinas
On Wed, Mar 17, 2021 at 02:37:57PM +, Catalin Marinas wrote: > On Thu, Feb 25, 2021 at 12:20:56PM +0100, Arnd Bergmann wrote: > > diff --git a/arch/arm64/kernel/vmlinux.lds.S > > b/arch/arm64/kernel/vmlinux.lds.S > > index bad2b9eaab22..926cdb597a45 100644 > > ---

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-17 Thread Catalin Marinas
On Thu, Feb 25, 2021 at 12:20:56PM +0100, Arnd Bergmann wrote: > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S > index bad2b9eaab22..926cdb597a45 100644 > --- a/arch/arm64/kernel/vmlinux.lds.S > +++ b/arch/arm64/kernel/vmlinux.lds.S > @@ -217,7 +217,7 @@ SECTIONS >

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Fangrui Song
On 2021-03-10, Nicolas Pitre wrote: On Mon, 1 Mar 2021, Nicholas Piggin wrote: Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > Unlike what Nick expected in his submission, I now think the annotations > will be needed for LTO just like they are for --gc-sections. Yeah I

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Fangrui Song
On 2021-03-10, Arnd Bergmann wrote: On Wed, Mar 10, 2021 at 9:50 PM Masahiro Yamada wrote: On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: masahiro@oscar:~/ref/linux$ echo 'void this_func_is_unused(void) {}' >>

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Nicolas Pitre
On Wed, 10 Mar 2021, Nick Desaulniers wrote: > On Wed, Mar 10, 2021 at 1:08 PM Arnd Bergmann wrote: > > > > On Wed, Mar 10, 2021 at 9:50 PM Masahiro Yamada > > wrote: > > > On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > > > > Excerpts from Arnd Bergmann's message of February 27,

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Nick Desaulniers
On Wed, Mar 10, 2021 at 1:08 PM Arnd Bergmann wrote: > > On Wed, Mar 10, 2021 at 9:50 PM Masahiro Yamada wrote: > > On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > > > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > > > > > masahiro@oscar:~/ref/linux$ echo 'void

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Sedat Dilek
On Wed, Mar 10, 2021 at 10:47 PM Nicolas Pitre wrote: ... > > With CONFIG_TRIM_UNUSED_KSYMS=y I see a 3x-loops of building .version > > and folowing steps - got no answer if this is intended. > > Yes it is intended. I explained it here: > > https://lkml.org/lkml/2021/3/9/1099 > Ah, cool. Thanks

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Nicolas Pitre
On Wed, 10 Mar 2021, Sedat Dilek wrote: > The best results on size-reduction of vmlinux I got with Clang-CFI on x86-64. > > Clang-LTO and Clang-CFI: > I was able to build with CONFIG_TRIM_UNUSED_KSYMS=y which needs to add > a whitelist file or add a whitelist to scripts/gen_autoksyms.sh. > And

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Rasmus Villemoes
On 10/03/2021 21.49, Masahiro Yamada wrote: > On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > > I tested LD_DEAD_CODE_DATA_ELIMINATION for the latest kernel. > > I added an unused function, this_func_is_unused(), > then built the ppc kernel with LD_DEAD_CODE_DATA_ELIMINATION. > > It

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Nicolas Pitre
On Mon, 1 Mar 2021, Nicholas Piggin wrote: > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > > Unlike what Nick expected in his submission, I now think the annotations > > will be needed for LTO just like they are for --gc-sections. > > Yeah I wasn't sure exactly what LTO

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Sedat Dilek
On Wed, Mar 10, 2021 at 10:08 PM Arnd Bergmann wrote: > > On Wed, Mar 10, 2021 at 9:50 PM Masahiro Yamada wrote: > > On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > > > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > > > > > masahiro@oscar:~/ref/linux$ echo 'void

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Arnd Bergmann
On Wed, Mar 10, 2021 at 9:50 PM Masahiro Yamada wrote: > On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > > masahiro@oscar:~/ref/linux$ echo 'void this_func_is_unused(void) {}' > >> kernel/cpu.c >

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-03-10 Thread Masahiro Yamada
On Mon, Mar 1, 2021 at 10:11 AM Nicholas Piggin wrote: > > Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > > On Fri, Feb 26, 2021 at 10:13 PM 'Fangrui Song' via Clang Built Linux > > wrote: > >> > >> For folks who are interested in --gc-sections on metadata sections, > >> I

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-28 Thread Nicholas Piggin
Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm: > On Fri, Feb 26, 2021 at 10:13 PM 'Fangrui Song' via Clang Built Linux > wrote: >> >> For folks who are interested in --gc-sections on metadata sections, >> I want to bring you awareness of the implication of __start_/__stop_

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-27 Thread Arnd Bergmann
On Fri, Feb 26, 2021 at 10:13 PM 'Fangrui Song' via Clang Built Linux wrote: > > For folks who are interested in --gc-sections on metadata sections, > I want to bring you awareness of the implication of __start_/__stop_ symbols > and C identifier name sections. > You can see

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-26 Thread Fangrui Song
On 2021-02-25, Arnd Bergmann wrote: From: Arnd Bergmann When looking at kernel size optimizations, I found that arm64 does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which enables the --gc-sections flag to the linker. I see that for a defconfig build with llvm, there are some

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-26 Thread Sedat Dilek
On Fri, Feb 26, 2021 at 10:51 AM Arnd Bergmann wrote: > > On Fri, Feb 26, 2021 at 10:05 AM Sedat Dilek wrote: > > On Fri, Feb 26, 2021 at 9:14 AM Arnd Bergmann wrote: > > > > > > BTW, is CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y setable for x86 (64bit)? > > > > ( Did not look or check for it. ) >

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-26 Thread Arnd Bergmann
On Fri, Feb 26, 2021 at 10:05 AM Sedat Dilek wrote: > On Fri, Feb 26, 2021 at 9:14 AM Arnd Bergmann wrote: > > > > BTW, is CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y setable for x86 (64bit)? > > > ( Did not look or check for it. ) > > > > No, in mainline, HAVE_LD_DEAD_CODE_DATA_ELIMINATION is

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-26 Thread Sedat Dilek
On Fri, Feb 26, 2021 at 9:14 AM Arnd Bergmann wrote: > > On Fri, Feb 26, 2021 at 1:36 AM Sedat Dilek wrote: > > > > On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > > > > > From: Arnd Bergmann > > > > > > When looking at kernel size optimizations, I found that arm64 > > > does not

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-26 Thread Arnd Bergmann
On Fri, Feb 26, 2021 at 1:36 AM Sedat Dilek wrote: > > On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > > > From: Arnd Bergmann > > > > When looking at kernel size optimizations, I found that arm64 > > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > > which enables the

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-25 Thread Sedat Dilek
On Thu, Feb 25, 2021 at 12:21 PM Arnd Bergmann wrote: > > From: Arnd Bergmann > > When looking at kernel size optimizations, I found that arm64 > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > which enables the --gc-sections flag to the linker. > > I see that for a defconfig

Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-25 Thread Kees Cook
On Thu, Feb 25, 2021 at 12:20:56PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > When looking at kernel size optimizations, I found that arm64 > does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, > which enables the --gc-sections flag to the linker. > > I see that for a

[PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

2021-02-25 Thread Arnd Bergmann
From: Arnd Bergmann When looking at kernel size optimizations, I found that arm64 does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which enables the --gc-sections flag to the linker. I see that for a defconfig build with llvm, there are some notable improvements from enabling