diff mbox series

[1/2] powerpc: Discard .rela* sections if CONFIG_RELOCATABLE is undefined

Message ID 20200428014900.407098-1-hjl.tools@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series [1/2] powerpc: Discard .rela* sections if CONFIG_RELOCATABLE is undefined | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (54dc28ff5e0b3585224d49a31b53e030342ca5c3)
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

H.J. Lu April 28, 2020, 1:48 a.m. UTC
arch/powerpc/kernel/vmlinux.lds.S has

        DISCARDS
        /DISCARD/ : {
                *(*.EMB.apuinfo)
                *(.glink .iplt .plt .rela* .comment)
                *(.gnu.version*)
                *(.gnu.attributes)
                *(.eh_frame)
        }

Since .rela* sections are needed when CONFIG_RELOCATABLE is defined,
change to discard .rela* sections if CONFIG_RELOCATABLE is undefined.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
---
 arch/powerpc/kernel/vmlinux.lds.S | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Christophe Leroy April 28, 2020, 5:31 a.m. UTC | #1
Hi,

Le 28/04/2020 à 03:48, H.J. Lu a écrit :
> arch/powerpc/kernel/vmlinux.lds.S has
> 
>          DISCARDS
>          /DISCARD/ : {
>                  *(*.EMB.apuinfo)
>                  *(.glink .iplt .plt .rela* .comment)
>                  *(.gnu.version*)
>                  *(.gnu.attributes)
>                  *(.eh_frame)
>          }
> 
> Since .rela* sections are needed when CONFIG_RELOCATABLE is defined,
> change to discard .rela* sections if CONFIG_RELOCATABLE is undefined.

Your explanation and especially the subject are unclear.

 From the subject you understand that you are adding a discard of the 
.rela* sections if CONFIG_RELOCATABLE is undefined.

But when reading the patch, you see that it is the contrary: you are 
removing a discard of the .rela* sections if CONFIG_RELOCATABLE is defined.


So I think the subject could instead be:

	Only discard .rela* sections when CONFIG_RELOCATABLE is undefined

Or maybe better:

	Keep .rela* sections when CONFIG_RELOCATABLE is defined

And the explanation could be:

	Since .rela* sections are needed when CONFIG_RELOCATABLE
	is defined, don't discard .rela* sections if
	CONFIG_RELOCATABLE is defined.

> 
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> ---
>   arch/powerpc/kernel/vmlinux.lds.S | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
> index 31a0f201fb6f..4ba07734a210 100644
> --- a/arch/powerpc/kernel/vmlinux.lds.S
> +++ b/arch/powerpc/kernel/vmlinux.lds.S
> @@ -366,9 +366,12 @@ SECTIONS
>   	DISCARDS
>   	/DISCARD/ : {
>   		*(*.EMB.apuinfo)
> -		*(.glink .iplt .plt .rela* .comment)
> +		*(.glink .iplt .plt .comment)
>   		*(.gnu.version*)
>   		*(.gnu.attributes)
>   		*(.eh_frame)
> +#ifndef CONFIG_RELOCATABLE
> +		*(.rela*)
> +#endif
>   	}
>   }
> 

Christophe
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 31a0f201fb6f..4ba07734a210 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -366,9 +366,12 @@  SECTIONS
 	DISCARDS
 	/DISCARD/ : {
 		*(*.EMB.apuinfo)
-		*(.glink .iplt .plt .rela* .comment)
+		*(.glink .iplt .plt .comment)
 		*(.gnu.version*)
 		*(.gnu.attributes)
 		*(.eh_frame)
+#ifndef CONFIG_RELOCATABLE
+		*(.rela*)
+#endif
 	}
 }