diff mbox

[1/3] ARM: zImage: ensure it is always a multiple of 64 bits in size

Message ID 1307858800-16712-2-git-send-email-nicolas.pitre@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Pitre June 12, 2011, 6:06 a.m. UTC
This is needed for proper alignment when the DTB appending feature
is used.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/boot/compressed/vmlinux.lds.in |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Tony Lindgren June 13, 2011, 10:43 a.m. UTC | #1
* Nicolas Pitre <nicolas.pitre@linaro.org> [110611 23:02]:
> This is needed for proper alignment when the DTB appending feature
> is used.
> 
> Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/boot/compressed/vmlinux.lds.in |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
> index ea80abe..6c02db1 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.in
> +++ b/arch/arm/boot/compressed/vmlinux.lds.in
> @@ -47,6 +47,9 @@ SECTIONS
>    .got			: { *(.got) }
>    _got_end = .;
>    .got.plt		: { *(.got.plt) }
> +
> +  /* ensure the zImage file size is always a multiple of 64 bits */
> +  .pad			: { BYTE(0); . = ALIGN(8); }
>    _edata = .;
>  
>    . = BSS_START;
> -- 
> 1.7.4
>
Russell King - ARM Linux June 13, 2011, 11:24 a.m. UTC | #2
On Sun, Jun 12, 2011 at 02:06:38AM -0400, Nicolas Pitre wrote:
> diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
> index ea80abe..6c02db1 100644
> --- a/arch/arm/boot/compressed/vmlinux.lds.in
> +++ b/arch/arm/boot/compressed/vmlinux.lds.in
> @@ -47,6 +47,9 @@ SECTIONS
>    .got			: { *(.got) }
>    _got_end = .;
>    .got.plt		: { *(.got.plt) }
> +
> +  /* ensure the zImage file size is always a multiple of 64 bits */
> +  .pad			: { BYTE(0); . = ALIGN(8); }

Why add a byte before aligning?  Isn't merely aligning to 64-bit sufficient?
Nicolas Pitre June 13, 2011, 2:06 p.m. UTC | #3
On Mon, 13 Jun 2011, Russell King - ARM Linux wrote:

> On Sun, Jun 12, 2011 at 02:06:38AM -0400, Nicolas Pitre wrote:
> > diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
> > index ea80abe..6c02db1 100644
> > --- a/arch/arm/boot/compressed/vmlinux.lds.in
> > +++ b/arch/arm/boot/compressed/vmlinux.lds.in
> > @@ -47,6 +47,9 @@ SECTIONS
> >    .got			: { *(.got) }
> >    _got_end = .;
> >    .got.plt		: { *(.got.plt) }
> > +
> > +  /* ensure the zImage file size is always a multiple of 64 bits */
> > +  .pad			: { BYTE(0); . = ALIGN(8); }
> 
> Why add a byte before aligning?  Isn't merely aligning to 64-bit sufficient?

No.  If a section is empty, despite the align statement, ld would simply 
omit it entirely and the output file size won't be aligned.


Nicolas
diff mbox

Patch

diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index ea80abe..6c02db1 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -47,6 +47,9 @@  SECTIONS
   .got			: { *(.got) }
   _got_end = .;
   .got.plt		: { *(.got.plt) }
+
+  /* ensure the zImage file size is always a multiple of 64 bits */
+  .pad			: { BYTE(0); . = ALIGN(8); }
   _edata = .;
 
   . = BSS_START;