linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Change the location of DISCARDS
@ 2020-11-04 10:48 Youling Tang
  2020-11-05 21:47 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Youling Tang @ 2020-11-04 10:48 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: linux-arm-kernel, linux-kernel, linux-riscv, tangyouling

In the include/asm-generic/vmlinux.lds.h file, the "must be the last"
comment indicates that DISCARDS should be placed in the last position
of SECTIONS, like x86, mips, riscv, etc.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
 arch/arm64/kernel/vmlinux.lds.S | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 1bda604..bf31074 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -109,12 +109,6 @@ SECTIONS
 	 * matching the same input section name.  There is no documented
 	 * order of matching.
 	 */
-	DISCARDS
-	/DISCARD/ : {
-		*(.interp .dynamic)
-		*(.dynsym .dynstr .hash .gnu.hash)
-	}
-
 	. = KIMAGE_VADDR;
 
 	.head.text : {
@@ -284,6 +278,13 @@ SECTIONS
 
 	.data.rel.ro : { *(.data.rel.ro) }
 	ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!")
+
+	/* Sections to be discarded */
+	DISCARDS
+	/DISCARD/ : {
+		*(.interp .dynamic)
+		*(.dynsym .dynstr .hash .gnu.hash)
+	}
 }
 
 #include "image-vars.h"
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: Change the location of DISCARDS
  2020-11-04 10:48 [PATCH] arm64: Change the location of DISCARDS Youling Tang
@ 2020-11-05 21:47 ` Will Deacon
  2020-11-06  1:06   ` tangyouling
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2020-11-05 21:47 UTC (permalink / raw)
  To: Youling Tang
  Cc: Catalin Marinas, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-arm-kernel, linux-kernel, linux-riscv, ardb

On Wed, Nov 04, 2020 at 06:48:52PM +0800, Youling Tang wrote:
> In the include/asm-generic/vmlinux.lds.h file, the "must be the last"
> comment indicates that DISCARDS should be placed in the last position
> of SECTIONS, like x86, mips, riscv, etc.
> 
> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
> ---
>  arch/arm64/kernel/vmlinux.lds.S | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)

Why does this section need to be last?

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: Change the location of DISCARDS
  2020-11-05 21:47 ` Will Deacon
@ 2020-11-06  1:06   ` tangyouling
  2020-11-06  9:07     ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: tangyouling @ 2020-11-06  1:06 UTC (permalink / raw)
  To: Will Deacon
  Cc: Catalin Marinas, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-arm-kernel, linux-kernel, linux-riscv, ardb

Hi, Will

In the include/asm-generic/vmlinux.lds.h:978, the description is as follows:
DISCARDS must be the last of output section definitions so that such archs
put those in earlier section definitions.

Thanks,

Youling


On 11/06/2020 05:47 AM, Will Deacon wrote:
> In the include/asm-generic/vmlinux.lds.h file


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: Change the location of DISCARDS
  2020-11-06  1:06   ` tangyouling
@ 2020-11-06  9:07     ` Will Deacon
  2020-11-12 13:17       ` Catalin Marinas
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2020-11-06  9:07 UTC (permalink / raw)
  To: tangyouling
  Cc: Catalin Marinas, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-arm-kernel, linux-kernel, linux-riscv, ardb

On Fri, Nov 06, 2020 at 09:06:42AM +0800, tangyouling wrote:
> In the include/asm-generic/vmlinux.lds.h:978, the description is as follows:
> DISCARDS must be the last of output section definitions so that such archs
> put those in earlier section definitions.

Sure, I see that text, but I don't get why it matters. It would be nice to
have some rationale as to what could go wrong if they aren't at the end,
so we can improve that comment and avoid the inevitable regression in the
future when things get shuffled around.

Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: Change the location of DISCARDS
  2020-11-06  9:07     ` Will Deacon
@ 2020-11-12 13:17       ` Catalin Marinas
  0 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2020-11-12 13:17 UTC (permalink / raw)
  To: Will Deacon
  Cc: tangyouling, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	linux-arm-kernel, linux-kernel, linux-riscv, ardb

On Fri, Nov 06, 2020 at 09:07:38AM +0000, Will Deacon wrote:
> On Fri, Nov 06, 2020 at 09:06:42AM +0800, tangyouling wrote:
> > In the include/asm-generic/vmlinux.lds.h:978, the description is as follows:
> > DISCARDS must be the last of output section definitions so that such archs
> > put those in earlier section definitions.
> 
> Sure, I see that text, but I don't get why it matters. It would be nice to
> have some rationale as to what could go wrong if they aren't at the end,
> so we can improve that comment and avoid the inevitable regression in the
> future when things get shuffled around.

Maybe on other architectures or some old toolchains made a difference in
the resulting binary image size. It doesn't seem to be the case for
arm64.

-- 
Catalin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-12 13:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 10:48 [PATCH] arm64: Change the location of DISCARDS Youling Tang
2020-11-05 21:47 ` Will Deacon
2020-11-06  1:06   ` tangyouling
2020-11-06  9:07     ` Will Deacon
2020-11-12 13:17       ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).