diff mbox

[U-Boot] arm: fix a double-definition error of _start symbol

Message ID 1401156989-6997-1-git-send-email-yamada.m@jp.panasonic.com
State Accepted
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Masahiro Yamada May 27, 2014, 2:16 a.m. UTC
The symbol "_start" is defined twice in arch/arm/lib/vectors.S:
around line 48 and line 54.

If CONFIG_SYS_DV_NOR_BOOT_CFG is defined (as on calimain board),
build fails:

  arch/arm/lib/vectors.S: Assembler messages:
  arch/arm/lib/vectors.S:54: Error: symbol `_start' is already defined
  make[1]: *** [arch/arm/lib/vectors.o] Error 1
  make: *** [arch/arm/lib] Error 2

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
---
 arch/arm/lib/vectors.S | 2 --
 1 file changed, 2 deletions(-)

Comments

Albert ARIBAUD June 9, 2014, 8:40 a.m. UTC | #1
Hi Masahiro,

On Tue, 27 May 2014 11:16:29 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> The symbol "_start" is defined twice in arch/arm/lib/vectors.S:
> around line 48 and line 54.
> 
> If CONFIG_SYS_DV_NOR_BOOT_CFG is defined (as on calimain board),
> build fails:
> 
>   arch/arm/lib/vectors.S: Assembler messages:
>   arch/arm/lib/vectors.S:54: Error: symbol `_start' is already defined
>   make[1]: *** [arch/arm/lib/vectors.o] Error 1
>   make: *** [arch/arm/lib] Error 2

Apart from the shame of having written this double definition myself and
missed it entirely, I am surprised because this error (obviously) does
not occur on my setup. Which toolchain are you using?

Anyway:

> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
>  arch/arm/lib/vectors.S | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S
> index fad00da..493f337 100644
> --- a/arch/arm/lib/vectors.S
> +++ b/arch/arm/lib/vectors.S
> @@ -45,8 +45,6 @@
>   *************************************************************************
>   */
>  
> -_start:
> -
>  #ifdef CONFIG_SYS_DV_NOR_BOOT_CFG
>  	.word	CONFIG_SYS_DV_NOR_BOOT_CFG
>  #endif

Applied to u-boot-arm/master, thanks!

Amicalement,
Masahiro Yamada June 9, 2014, 9:44 a.m. UTC | #2
Hi Albert,


> 
> Apart from the shame of having written this double definition myself and
> missed it entirely, I am surprised because this error (obviously) does
> not occur on my setup. Which toolchain are you using?

It is not because of the toolchain difference.

You should understand the problem I mentioned in the other mail.

In your tree,  CONFIG_SYS_DV_NOR_BOOT_CFG is never defined
in arch/arm/lib/vectors.S

So,  arch/arm/lib/vectors.S  in your source tree in  always like this:

_start:
_start:
        ldr     pc, _reset
        ldr     pc, _undefined_instruction
        ldr     pc, _software_interrupt
        ldr     pc, _prefetch_abort
        ldr     pc, _data_abort
        ldr     pc, _not_used
        ldr     pc, _irq
        ldr     pc, _fiq


It is true that  "_start" symbol appears twice,
but both are pointing to the same address.

That's why you never see the error message.
(I mean, this problem is hidden behind another problem.)

You should  fix the first problem.
http://patchwork.ozlabs.org/patch/352484/


And then, the code should be like follows where CONFIG_SYS_DV_NOR_BOOT_CFG is defined.

_start:
       .word   CONFIG_SYS_DV_NOR_BOOT_CFG
_start:
        ldr     pc, _reset
        ldr     pc, _undefined_instruction
        ldr     pc, _software_interrupt
        ldr     pc, _prefetch_abort
        ldr     pc, _data_abort
        ldr     pc, _not_used
        ldr     pc, _irq
        ldr     pc, _fiq

In this case,  two "_start" symbols point the different address.
You will see the error message like this:

> >   arch/arm/lib/vectors.S: Assembler messages:
> >   arch/arm/lib/vectors.S:54: Error: symbol `_start' is already defined
> >   make[1]: *** [arch/arm/lib/vectors.o] Error 1
> >   make: *** [arch/arm/lib] Error 2




> 
> Applied to u-boot-arm/master, thanks!

No. 

Please apply
http://patchwork.ozlabs.org/patch/352484/
http://patchwork.ozlabs.org/patch/352672/

in this order to keep the commit-description sane.


Best Regards
Masahiro Yamada
Albert ARIBAUD June 9, 2014, 9:58 a.m. UTC | #3
Hi Masahiro,

On Mon, 09 Jun 2014 18:44:08 +0900, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:

> Hi Albert,
> 
> 
> > 
> > Apart from the shame of having written this double definition myself and
> > missed it entirely, I am surprised because this error (obviously) does
> > not occur on my setup. Which toolchain are you using?
> 
> It is not because of the toolchain difference.
> 
> You should understand the problem I mentioned in the other mail.
> 
> In your tree,  CONFIG_SYS_DV_NOR_BOOT_CFG is never defined
> in arch/arm/lib/vectors.S
> 
> So,  arch/arm/lib/vectors.S  in your source tree in  always like this:
> 
> _start:
> _start:
>         ldr     pc, _reset
>         ldr     pc, _undefined_instruction
>         ldr     pc, _software_interrupt
>         ldr     pc, _prefetch_abort
>         ldr     pc, _data_abort
>         ldr     pc, _not_used
>         ldr     pc, _irq
>         ldr     pc, _fiq
> 
> 
> It is true that  "_start" symbol appears twice,
> but both are pointing to the same address.
> 
> That's why you never see the error message.
> (I mean, this problem is hidden behind another problem.)
> 
> You should  fix the first problem.
> http://patchwork.ozlabs.org/patch/352484/
> 
> 
> And then, the code should be like follows where CONFIG_SYS_DV_NOR_BOOT_CFG is defined.
> 
> _start:
>        .word   CONFIG_SYS_DV_NOR_BOOT_CFG
> _start:
>         ldr     pc, _reset
>         ldr     pc, _undefined_instruction
>         ldr     pc, _software_interrupt
>         ldr     pc, _prefetch_abort
>         ldr     pc, _data_abort
>         ldr     pc, _not_used
>         ldr     pc, _irq
>         ldr     pc, _fiq
> 
> In this case,  two "_start" symbols point the different address.
> You will see the error message like this:
> 
> > >   arch/arm/lib/vectors.S: Assembler messages:
> > >   arch/arm/lib/vectors.S:54: Error: symbol `_start' is already defined
> > >   make[1]: *** [arch/arm/lib/vectors.o] Error 1
> > >   make: *** [arch/arm/lib] Error 2

Thanks for the clarification. However:

> > Applied to u-boot-arm/master, thanks!
> 
> No. 
> 
> Please apply
> http://patchwork.ozlabs.org/patch/352484/
> http://patchwork.ozlabs.org/patch/352672/
> 
> in this order to keep the commit-description sane.

See my comment on the first patch commit message.

Besides, the second patch is a fix of its own accord, regardless to the
fact that it was hidden by another bug, so I'll keep it in as-is.

(incidentally, patches which do have ordering constraints should be
posted as a series.)

> Best Regards
> Masahiro Yamada

Amicalement,
diff mbox

Patch

diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S
index fad00da..493f337 100644
--- a/arch/arm/lib/vectors.S
+++ b/arch/arm/lib/vectors.S
@@ -45,8 +45,6 @@ 
  *************************************************************************
  */
 
-_start:
-
 #ifdef CONFIG_SYS_DV_NOR_BOOT_CFG
 	.word	CONFIG_SYS_DV_NOR_BOOT_CFG
 #endif