linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] module: set .init_array alignment to 8
@ 2017-03-08  1:31 David Daney
  2017-03-08  1:35 ` David Daney
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Daney @ 2017-03-08  1:31 UTC (permalink / raw)
  To: Jessica Yu, Rusty Russell, Andrey Ryabinin, linux-kernel
  Cc: Andrew Morton, David Daney

The proper idiom for aligning linker sections in modules is different
than for built-in sections.  ". = ALIGN();" followed by a forced
output address of 0 does nothing, as forcing the address changes the
value of ".".

Use output section alignment specifier instead.

Fixes: 9ddf82521c86 ("kernel: add support for .init_array.* constructors")
Signed-off-by: David Daney <david.daney@cavium.com>
---

I noticed this when doing the __jump_table thing.  Doesn't seem to
break a defconfig build, but otherwise untested.

 scripts/module-common.lds | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/module-common.lds b/scripts/module-common.lds
index 9b6e246..d61b9e8 100644
--- a/scripts/module-common.lds
+++ b/scripts/module-common.lds
@@ -20,8 +20,7 @@ SECTIONS {
 	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
 	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
 
-	. = ALIGN(8);
-	.init_array		0 : { *(SORT(.init_array.*)) *(.init_array) }
+	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
 
 	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
 }
-- 
2.9.3

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

* Re: [PATCH] module: set .init_array alignment to 8
  2017-03-08  1:31 [PATCH] module: set .init_array alignment to 8 David Daney
@ 2017-03-08  1:35 ` David Daney
  2017-03-09 14:26 ` Andrey Ryabinin
  2017-03-13 18:46 ` Jessica Yu
  2 siblings, 0 replies; 4+ messages in thread
From: David Daney @ 2017-03-08  1:35 UTC (permalink / raw)
  To: David Daney, Jessica Yu, Rusty Russell, Andrey Ryabinin,
	linux-kernel, Andrey Ryabinin
  Cc: Andrew Morton

It looks like Andrey's e-mail changed.  Replying with what I hope is a 
valid e-mail for Andrey.

On 03/07/2017 05:31 PM, David Daney wrote:
> The proper idiom for aligning linker sections in modules is different
> than for built-in sections.  ". = ALIGN();" followed by a forced
> output address of 0 does nothing, as forcing the address changes the
> value of ".".
>
> Use output section alignment specifier instead.
>
> Fixes: 9ddf82521c86 ("kernel: add support for .init_array.* constructors")
> Signed-off-by: David Daney <david.daney@cavium.com>
> ---
>
> I noticed this when doing the __jump_table thing.  Doesn't seem to
> break a defconfig build, but otherwise untested.
>
>  scripts/module-common.lds | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/scripts/module-common.lds b/scripts/module-common.lds
> index 9b6e246..d61b9e8 100644
> --- a/scripts/module-common.lds
> +++ b/scripts/module-common.lds
> @@ -20,8 +20,7 @@ SECTIONS {
>  	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
>  	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
>
> -	. = ALIGN(8);
> -	.init_array		0 : { *(SORT(.init_array.*)) *(.init_array) }
> +	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
>
>  	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
>  }
>

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

* Re: [PATCH] module: set .init_array alignment to 8
  2017-03-08  1:31 [PATCH] module: set .init_array alignment to 8 David Daney
  2017-03-08  1:35 ` David Daney
@ 2017-03-09 14:26 ` Andrey Ryabinin
  2017-03-13 18:46 ` Jessica Yu
  2 siblings, 0 replies; 4+ messages in thread
From: Andrey Ryabinin @ 2017-03-09 14:26 UTC (permalink / raw)
  To: David Daney, Jessica Yu, Rusty Russell, linux-kernel; +Cc: Andrew Morton

On 03/08/2017 04:31 AM, David Daney wrote:
> The proper idiom for aligning linker sections in modules is different
> than for built-in sections.  ". = ALIGN();" followed by a forced
> output address of 0 does nothing, as forcing the address changes the
> value of ".".
> 
> Use output section alignment specifier instead.
> 
> Fixes: 9ddf82521c86 ("kernel: add support for .init_array.* constructors")
> Signed-off-by: David Daney <david.daney@cavium.com>

Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>

> ---
> 
> I noticed this when doing the __jump_table thing.  Doesn't seem to
> break a defconfig build, but otherwise untested.
> 
>  scripts/module-common.lds | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/module-common.lds b/scripts/module-common.lds
> index 9b6e246..d61b9e8 100644
> --- a/scripts/module-common.lds
> +++ b/scripts/module-common.lds
> @@ -20,8 +20,7 @@ SECTIONS {
>  	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
>  	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
>  
> -	. = ALIGN(8);
> -	.init_array		0 : { *(SORT(.init_array.*)) *(.init_array) }
> +	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
>  
>  	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
>  }
> 

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

* Re: [PATCH] module: set .init_array alignment to 8
  2017-03-08  1:31 [PATCH] module: set .init_array alignment to 8 David Daney
  2017-03-08  1:35 ` David Daney
  2017-03-09 14:26 ` Andrey Ryabinin
@ 2017-03-13 18:46 ` Jessica Yu
  2 siblings, 0 replies; 4+ messages in thread
From: Jessica Yu @ 2017-03-13 18:46 UTC (permalink / raw)
  To: David Daney; +Cc: Rusty Russell, Andrey Ryabinin, linux-kernel, Andrew Morton

+++ David Daney [07/03/17 17:31 -0800]:
>The proper idiom for aligning linker sections in modules is different
>than for built-in sections.  ". = ALIGN();" followed by a forced
>output address of 0 does nothing, as forcing the address changes the
>value of ".".
>
>Use output section alignment specifier instead.
>
>Fixes: 9ddf82521c86 ("kernel: add support for .init_array.* constructors")
>Signed-off-by: David Daney <david.daney@cavium.com>

Good catch, thanks. I've applied this to modules-next.

Jessica

>I noticed this when doing the __jump_table thing.  Doesn't seem to
>break a defconfig build, but otherwise untested.
>
> scripts/module-common.lds | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/scripts/module-common.lds b/scripts/module-common.lds
>index 9b6e246..d61b9e8 100644
>--- a/scripts/module-common.lds
>+++ b/scripts/module-common.lds
>@@ -20,8 +20,7 @@ SECTIONS {
> 	__kcrctab_unused_gpl	0 : { *(SORT(___kcrctab_unused_gpl+*)) }
> 	__kcrctab_gpl_future	0 : { *(SORT(___kcrctab_gpl_future+*)) }
>
>-	. = ALIGN(8);
>-	.init_array		0 : { *(SORT(.init_array.*)) *(.init_array) }
>+	.init_array		0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) }
>
> 	__jump_table		0 : ALIGN(8) { KEEP(*(__jump_table)) }
> }
>-- 
>2.9.3
>

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

end of thread, other threads:[~2017-03-13 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-08  1:31 [PATCH] module: set .init_array alignment to 8 David Daney
2017-03-08  1:35 ` David Daney
2017-03-09 14:26 ` Andrey Ryabinin
2017-03-13 18:46 ` Jessica Yu

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).