All of lore.kernel.org
 help / color / mirror / Atom feed
From: "liuyuntao (F)" <liuyuntao12@huawei.com>
To: Arnd Bergmann <arnd@arndb.de>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: Russell King <linux@armlinux.org.uk>, Andrew Davis <afd@ti.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Jonathan Corbet <corbet@lwn.net>, Mike Rapoport <rppt@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH -next] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
Date: Thu, 7 Mar 2024 11:09:53 +0800	[thread overview]
Message-ID: <0255a8e9-d973-497c-9011-5651e0002a9c@huawei.com> (raw)
In-Reply-To: <2397d8dd-8053-4167-9aac-f5d7c05a98da@huawei.com>



On 2024/2/27 16:06, liuyuntao (F) wrote:
> 
> 
> On 2024/2/23 0:04, Arnd Bergmann wrote:
>> On Thu, Feb 22, 2024, at 12:24, liuyuntao (F) wrote:
>>>
>>> The position of the caret has been moved below the right brace
>>> of { KEEP(*(.vectors.bhb.loop8)) }, indicating that lld is treating
>>> the entire `KEEP(*(.vectors))` as a file name. This could potentially be
>>> a bug in lld. Perhaps we can temporarily
>>> enable the DCE option only when option LD_IS_LLD is disabled,
>>> like risc-v:
>>>
>>> `select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD`.
>>
>> I would really like to see this working with lld if at all
>> possible, as it allows the combination of gc-sections with
>> lto and CONFIG_TRIM_UNUSED_KSYMS.
> 
Another way to preserve .vector sections without using KEEP annotation.
It boots well. How do you feel about this approach? and, could I submit 
a v2 patch?

1: Define ARM_VECTORS_TEXT to explicitly preserve .vectors section.

 > --- a/arch/arm/include/asm/vmlinux.lds.h
 > +++ b/arch/arm/include/asm/vmlinux.lds.h
 > @@ -87,6 +87,13 @@
 >                 *(.vfp11_veneer)                                \
 >                 *(.v4_bx)
 >
 > +#define ARM_VECTORS_TEXT                                       \
 > +       .vectors.text : {                                       \
 > +               KEEP(*(.vectors))                               \
 > +               KEEP(*(.vectors.bhb.loop8))                     \
 > +               KEEP(*(.vectors.bhb.bpiall))                    \
 > +       }
 > +
 >  #define ARM_TEXT                                               \
 >                 IDMAP_TEXT                                      \
 >                 __entry_text_start = .;                         \

2: Ref ARM_VECTORS_TEXT if config HAVE_LD_DEAD_CODE_DATA_ELIMINATION is 
enabled, and the same to arch/arm/kernel/vmlinux.lds.S

 > --- a/arch/arm/kernel/vmlinux-xip.lds.S 

 > +++ b/arch/arm/kernel/vmlinux-xip.lds.S 

 > @@ -135,6 +135,10 @@ SECTIONS 

 >         ARM_TCM 

 >  #endif 

 > 

 > +#ifdef HAVE_LD_DEAD_CODE_DATA_ELIMINATION 

 > +       ARM_VECTORS_TEXT 

 > +#endif 

 > + 

 >         /* 

 >          * End of copied data. We need a dummy section to get its 
LMA.
 >          * Also located before final ALIGN() as trailing padding is
 > not stored


WARNING: multiple messages have this Message-ID (diff)
From: "liuyuntao (F)" <liuyuntao12@huawei.com>
To: Arnd Bergmann <arnd@arndb.de>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: Russell King <linux@armlinux.org.uk>, Andrew Davis <afd@ti.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Jonathan Corbet <corbet@lwn.net>, Mike Rapoport <rppt@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH -next] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
Date: Thu, 7 Mar 2024 11:09:53 +0800	[thread overview]
Message-ID: <0255a8e9-d973-497c-9011-5651e0002a9c@huawei.com> (raw)
In-Reply-To: <2397d8dd-8053-4167-9aac-f5d7c05a98da@huawei.com>



On 2024/2/27 16:06, liuyuntao (F) wrote:
> 
> 
> On 2024/2/23 0:04, Arnd Bergmann wrote:
>> On Thu, Feb 22, 2024, at 12:24, liuyuntao (F) wrote:
>>>
>>> The position of the caret has been moved below the right brace
>>> of { KEEP(*(.vectors.bhb.loop8)) }, indicating that lld is treating
>>> the entire `KEEP(*(.vectors))` as a file name. This could potentially be
>>> a bug in lld. Perhaps we can temporarily
>>> enable the DCE option only when option LD_IS_LLD is disabled,
>>> like risc-v:
>>>
>>> `select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if !LD_IS_LLD`.
>>
>> I would really like to see this working with lld if at all
>> possible, as it allows the combination of gc-sections with
>> lto and CONFIG_TRIM_UNUSED_KSYMS.
> 
Another way to preserve .vector sections without using KEEP annotation.
It boots well. How do you feel about this approach? and, could I submit 
a v2 patch?

1: Define ARM_VECTORS_TEXT to explicitly preserve .vectors section.

 > --- a/arch/arm/include/asm/vmlinux.lds.h
 > +++ b/arch/arm/include/asm/vmlinux.lds.h
 > @@ -87,6 +87,13 @@
 >                 *(.vfp11_veneer)                                \
 >                 *(.v4_bx)
 >
 > +#define ARM_VECTORS_TEXT                                       \
 > +       .vectors.text : {                                       \
 > +               KEEP(*(.vectors))                               \
 > +               KEEP(*(.vectors.bhb.loop8))                     \
 > +               KEEP(*(.vectors.bhb.bpiall))                    \
 > +       }
 > +
 >  #define ARM_TEXT                                               \
 >                 IDMAP_TEXT                                      \
 >                 __entry_text_start = .;                         \

2: Ref ARM_VECTORS_TEXT if config HAVE_LD_DEAD_CODE_DATA_ELIMINATION is 
enabled, and the same to arch/arm/kernel/vmlinux.lds.S

 > --- a/arch/arm/kernel/vmlinux-xip.lds.S 

 > +++ b/arch/arm/kernel/vmlinux-xip.lds.S 

 > @@ -135,6 +135,10 @@ SECTIONS 

 >         ARM_TCM 

 >  #endif 

 > 

 > +#ifdef HAVE_LD_DEAD_CODE_DATA_ELIMINATION 

 > +       ARM_VECTORS_TEXT 

 > +#endif 

 > + 

 >         /* 

 >          * End of copied data. We need a dummy section to get its 
LMA.
 >          * Also located before final ALIGN() as trailing padding is
 > not stored


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-03-07  3:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20  8:15 [PATCH -next] arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Yuntao Liu
2024-02-20  8:15 ` Yuntao Liu
2024-02-20  8:40 ` Arnd Bergmann
2024-02-20  8:40   ` Arnd Bergmann
2024-02-20  9:53   ` liuyuntao (F)
2024-02-20  9:53     ` liuyuntao (F)
2024-02-21 15:51     ` Arnd Bergmann
2024-02-21 15:51       ` Arnd Bergmann
2024-02-22  9:52       ` Arnd Bergmann
2024-02-22  9:52         ` Arnd Bergmann
2024-02-22 11:32         ` liuyuntao (F)
2024-02-22 11:32           ` liuyuntao (F)
2024-02-22 11:24       ` liuyuntao (F)
2024-02-22 11:24         ` liuyuntao (F)
2024-02-22 16:04         ` Arnd Bergmann
2024-02-22 16:04           ` Arnd Bergmann
2024-02-23  1:39           ` liuyuntao (F)
2024-02-23  1:39             ` liuyuntao (F)
2024-02-23  6:32             ` Arnd Bergmann
2024-02-23  6:32               ` Arnd Bergmann
2024-02-27  8:06           ` liuyuntao (F)
2024-02-27  8:06             ` liuyuntao (F)
2024-03-07  3:09             ` liuyuntao (F) [this message]
2024-03-07  3:09               ` liuyuntao (F)
2024-03-07  7:29               ` Arnd Bergmann
2024-03-07  7:29                 ` Arnd Bergmann

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=0255a8e9-d973-497c-9011-5651e0002a9c@huawei.com \
    --to=liuyuntao12@huawei.com \
    --cc=afd@ti.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=geert+renesas@glider.be \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=robh@kernel.org \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.