Skip to contentSkip to conversation

arm: fix a double-definition error of _start symbol

PATCH New Masahiro Yamada 2 participants 4 messages May 27, 2014 – Jun 9, 2014 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: fix a double-definition error of _start symbol

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

---
 arch/arm/lib/vectors.S | 2 --
 1 file changed, 2 deletions(-)
arch/arm/lib/vectors.S +0 -2
index fad00da..493f337 100644
@@ -45,8 +45,6 @@
  *************************************************************************
  */
 
-_start:
-
 #ifdef CONFIG_SYS_DV_NOR_BOOT_CFG
 	.word	CONFIG_SYS_DV_NOR_BOOT_CFG
 #endif
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm: fix a double-definition error of _start symbol

Hi Masahiro,

Quoted 10 lines · Masahiro Yamada

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:

Quoted 11 lines
---
 arch/arm/lib/vectors.S | 2 --
 1 file changed, 2 deletions(-)
arch/arm/lib/vectors.S +0 -0
index fad00da..493f337 100644

arch/arm/lib/vectors.S line 50

Quoted 8 lines
arch/arm/lib/vectors.S +0 -2
@@ -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,

Signature · 1 line
Albert.
#2 lore raw

PATCH 1/1 arm: fix a double-definition error of _start symbol

Hi Albert,

Quoted 4 lines

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:

Quoted 10 lines
Quoted 4 lines

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

#3 lore raw

PATCH 1/1 arm: fix a double-definition error of _start symbol

Hi Masahiro,

Quoted 53 lines · Masahiro Yamada

Hi Albert,

Quoted 4 lines

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
Quoted 7 lines

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

Quoted 4 lines
Quoted 4 lines

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:

Quoted 9 lines
Quoted 1 line

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

Quoted 2 lines

Best Regards
Masahiro Yamada

Amicalement,

Signature · 1 line
Albert.