diff mbox series

template: Fix alignment

Message ID 20210803080305.866765-1-joel@jms.id.au
State Superseded
Headers show
Series template: Fix alignment | expand

Commit Message

Joel Stanley Aug. 3, 2021, 8:03 a.m. UTC
The assembler complains about unaliged data:

 ./template.S: Assembler messages:
 ./template.S:21: Error: misaligned data

If the included data is not an aligned size, the the symbols following
will be unaligned.

We lost the alignment directive in commit 5f3deee1289e ("template: new
libfdt requires 8-byte aligned fdt"), so add it back as it was before
that commit.

Reported by the buildroot autobuilder.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 template.S | 1 +
 1 file changed, 1 insertion(+)

Comments

Amitay Isaacs Aug. 3, 2021, 8:14 a.m. UTC | #1
On Tue, 2021-08-03 at 17:33 +0930, Joel Stanley wrote:
> The assembler complains about unaliged data:
> 
>  ./template.S: Assembler messages:
>  ./template.S:21: Error: misaligned data
> 
> If the included data is not an aligned size, the the symbols
> following
> will be unaligned.
> 
> We lost the alignment directive in commit 5f3deee1289e ("template:
> new
> libfdt requires 8-byte aligned fdt"), so add it back as it was before
> that commit.
> 
> Reported by the buildroot autobuilder.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  template.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/template.S b/template.S
> index ecf9bba0656d..df8c064d6bc0 100644
> --- a/template.S
> +++ b/template.S
> @@ -17,6 +17,7 @@
>  SYM_START(SYMBOL_PREFIX):
>  .incbin FILENAME
>  SYM_END(SYMBOL_PREFIX):
> +.align 4
>  SYM_SIZE(SYMBOL_PREFIX):
>         .long   SYM_END(SYMBOL_PREFIX) - SYM_START(SYMBOL_PREFIX)
>  .globl SYM_START(SYMBOL_PREFIX)
> -- 
> 2.32.0
> 

May be we should just drop the _end and _size symbols since they are
not used anywhere in the code.

Amitay.
Joel Stanley Aug. 3, 2021, 8:20 a.m. UTC | #2
On Tue, 3 Aug 2021 at 08:14, Amitay Isaacs <amitay@ozlabs.org> wrote:
>
> On Tue, 2021-08-03 at 17:33 +0930, Joel Stanley wrote:
> > The assembler complains about unaliged data:
> >
> >  ./template.S: Assembler messages:
> >  ./template.S:21: Error: misaligned data
> >
> > If the included data is not an aligned size, the the symbols
> > following
> > will be unaligned.
> >
> > We lost the alignment directive in commit 5f3deee1289e ("template:
> > new
> > libfdt requires 8-byte aligned fdt"), so add it back as it was before
> > that commit.
> >
> > Reported by the buildroot autobuilder.
> >
> > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > ---
> >  template.S | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/template.S b/template.S
> > index ecf9bba0656d..df8c064d6bc0 100644
> > --- a/template.S
> > +++ b/template.S
> > @@ -17,6 +17,7 @@
> >  SYM_START(SYMBOL_PREFIX):
> >  .incbin FILENAME
> >  SYM_END(SYMBOL_PREFIX):
> > +.align 4
> >  SYM_SIZE(SYMBOL_PREFIX):
> >         .long   SYM_END(SYMBOL_PREFIX) - SYM_START(SYMBOL_PREFIX)
> >  .globl SYM_START(SYMBOL_PREFIX)
> > --
> > 2.32.0
> >
>
> May be we should just drop the _end and _size symbols since they are
> not used anywhere in the code.

Sure. It looks like we still need to .align 4 for the start symbol, so
that could be done in addition to this fix?
Amitay Isaacs Aug. 3, 2021, 8:27 a.m. UTC | #3
On Tue, 2021-08-03 at 08:20 +0000, Joel Stanley wrote:
> On Tue, 3 Aug 2021 at 08:14, Amitay Isaacs <amitay@ozlabs.org> wrote:
> > 
> > On Tue, 2021-08-03 at 17:33 +0930, Joel Stanley wrote:
> > > The assembler complains about unaliged data:
> > > 
> > >  ./template.S: Assembler messages:
> > >  ./template.S:21: Error: misaligned data
> > > 
> > > If the included data is not an aligned size, the the symbols
> > > following
> > > will be unaligned.
> > > 
> > > We lost the alignment directive in commit 5f3deee1289e
> > > ("template:
> > > new
> > > libfdt requires 8-byte aligned fdt"), so add it back as it was
> > > before
> > > that commit.
> > > 
> > > Reported by the buildroot autobuilder.
> > > 
> > > Signed-off-by: Joel Stanley <joel@jms.id.au>
> > > ---
> > >  template.S | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/template.S b/template.S
> > > index ecf9bba0656d..df8c064d6bc0 100644
> > > --- a/template.S
> > > +++ b/template.S
> > > @@ -17,6 +17,7 @@
> > >  SYM_START(SYMBOL_PREFIX):
> > >  .incbin FILENAME
> > >  SYM_END(SYMBOL_PREFIX):
> > > +.align 4
> > >  SYM_SIZE(SYMBOL_PREFIX):
> > >         .long   SYM_END(SYMBOL_PREFIX) - SYM_START(SYMBOL_PREFIX)
> > >  .globl SYM_START(SYMBOL_PREFIX)
> > > --
> > > 2.32.0
> > > 
> > 
> > May be we should just drop the _end and _size symbols since they
> > are
> > not used anywhere in the code.
> 
> Sure. It looks like we still need to .align 4 for the start symbol,
> so
> that could be done in addition to this fix?

The start symbol has 8-byte alignment (by commit 5f3deee1289e).

Amitay.
diff mbox series

Patch

diff --git a/template.S b/template.S
index ecf9bba0656d..df8c064d6bc0 100644
--- a/template.S
+++ b/template.S
@@ -17,6 +17,7 @@ 
 SYM_START(SYMBOL_PREFIX):
 .incbin FILENAME
 SYM_END(SYMBOL_PREFIX):
+.align 4
 SYM_SIZE(SYMBOL_PREFIX):
 	.long	SYM_END(SYMBOL_PREFIX) - SYM_START(SYMBOL_PREFIX)
 .globl SYM_START(SYMBOL_PREFIX)