diff mbox series

[2/2] powerpc/vmlinux.lds: Discard .interp section

Message ID 20200227045933.22967-2-mpe@ellerman.id.au (mailing list archive)
State New
Headers show
Series [1/2] powerpc/vmlinux.lds: Explicitly retain .gnu.hash | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (65b2623f395a4e25ab3ff4cff1c9c7623619a22d)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch warning total: 0 errors, 1 warnings, 0 checks, 13 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Michael Ellerman Feb. 27, 2020, 4:59 a.m. UTC
The .interp section specifies which "interpreter", ie. dynamic loader,
the kernel requests. But that doesn't make any sense, the kernel is
not a regular binary that is run with an interpreter.

The content seems to be some default value, this file doesn't even
exist on my system:
  00000000  2f 75 73 72 2f 6c 69 62  2f 6c 64 2e 73 6f 2e 31  |/usr/lib/ld.so.1|

So the section serves no useful purpose and consumes a small amount of
space.

Also Alan Modra says we "likely could discard" it, so do so.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/vmlinux.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alan Modra Feb. 27, 2020, 6:27 a.m. UTC | #1
On Thu, Feb 27, 2020 at 03:59:33PM +1100, Michael Ellerman wrote:
> The .interp section specifies which "interpreter", ie. dynamic loader,
> the kernel requests. But that doesn't make any sense, the kernel is
> not a regular binary that is run with an interpreter.
> 
> The content seems to be some default value, this file doesn't even
> exist on my system:
>   00000000  2f 75 73 72 2f 6c 69 62  2f 6c 64 2e 73 6f 2e 31  |/usr/lib/ld.so.1|
> 
> So the section serves no useful purpose and consumes a small amount of
> space.
> 
> Also Alan Modra says we "likely could discard" it, so do so.

Yes, but you ought to check with the mimimum required binutils.  It is
quite possible that an older linker will blow up.

If the minimum required binutils is at least binutils-2.26 then
passing --no-dynamic-linker to ld is a more elegant solution.

> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/kernel/vmlinux.lds.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index 31a0f201fb6f..619ffbaf72ad 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -257,7 +257,6 @@ SECTIONS
>  	}
>  	.hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
>  	.gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
> -	.interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
>  	.rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
>  	{
>  		__rela_dyn_start = .;
> @@ -370,5 +369,6 @@ SECTIONS
>  		*(.gnu.version*)
>  		*(.gnu.attributes)
>  		*(.eh_frame)
> +		*(.interp)
>  	}
>  }
> -- 
> 2.21.1
Michael Ellerman March 27, 2020, 9:27 a.m. UTC | #2
Alan Modra <amodra@gmail.com> writes:
> On Thu, Feb 27, 2020 at 03:59:33PM +1100, Michael Ellerman wrote:
>> The .interp section specifies which "interpreter", ie. dynamic loader,
>> the kernel requests. But that doesn't make any sense, the kernel is
>> not a regular binary that is run with an interpreter.
>> 
>> The content seems to be some default value, this file doesn't even
>> exist on my system:
>>   00000000  2f 75 73 72 2f 6c 69 62  2f 6c 64 2e 73 6f 2e 31  |/usr/lib/ld.so.1|
>> 
>> So the section serves no useful purpose and consumes a small amount of
>> space.
>> 
>> Also Alan Modra says we "likely could discard" it, so do so.
>
> Yes, but you ought to check with the mimimum required binutils.  It is
> quite possible that an older linker will blow up.

OK, I guess I'll have to test.

> If the minimum required binutils is at least binutils-2.26 then
> passing --no-dynamic-linker to ld is a more elegant solution.

The current minimum is 2.21, though there's talk of increasing it to
2.23.

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 31a0f201fb6f..619ffbaf72ad 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -257,7 +257,6 @@  SECTIONS
 	}
 	.hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
 	.gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
-	.interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
 	.rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
 	{
 		__rela_dyn_start = .;
@@ -370,5 +369,6 @@  SECTIONS
 		*(.gnu.version*)
 		*(.gnu.attributes)
 		*(.eh_frame)
+		*(.interp)
 	}
 }