diff mbox series

[2/7] examples: rename __start to _start on MIPS

Message ID 20200420223418.117186-3-mhorne@FreeBSD.org
State New
Headers show
Series Add support for CONFIG_API on RISC-V | expand

Commit Message

Mitchell Horne April 20, 2020, 10:34 p.m. UTC
From: Mitchell Horne <mhorne at FreeBSD.org>

On MIPS, __start marks the entry point to the CONFIG_API demo program.
Change the name to _start, to be consistent with all other
architectures.

Signed-off-by: Mitchell Horne <mhorne at FreeBSD.org>
---
 examples/api/crt0.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Bin Meng April 23, 2020, 2:18 p.m. UTC | #1
On Tue, Apr 21, 2020 at 7:28 AM <mhorne at freebsd.org> wrote:
>
> From: Mitchell Horne <mhorne at FreeBSD.org>
>
> On MIPS, __start marks the entry point to the CONFIG_API demo program.
> Change the name to _start, to be consistent with all other
> architectures.
>
> Signed-off-by: Mitchell Horne <mhorne at FreeBSD.org>
> ---
>  examples/api/crt0.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
Daniel Schwierzeck April 23, 2020, 5:52 p.m. UTC | #2
+cc Wolfgang, Tom

Am 21.04.20 um 00:34 schrieb mhorne at FreeBSD.org:
> From: Mitchell Horne <mhorne at FreeBSD.org>
> 
> On MIPS, __start marks the entry point to the CONFIG_API demo program.
> Change the name to _start, to be consistent with all other
> architectures.
> 
> Signed-off-by: Mitchell Horne <mhorne at FreeBSD.org>
> ---
>  examples/api/crt0.S | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/examples/api/crt0.S b/examples/api/crt0.S
> index 57bba9d851..2f75f5a036 100644
> --- a/examples/api/crt0.S
> +++ b/examples/api/crt0.S
> @@ -42,12 +42,12 @@ syscall:
>  #elif defined(CONFIG_MIPS)
>  #include <asm/asm.h>
>  	.text
> -	.globl __start
> -	.ent __start
> -__start:
> +	.globl _start
> +	.ent _start
> +_start:
>  	PTR_S	$sp, search_hint
>  	b	main
> -	.end __start
> +	.end _start
>  
>  	.globl syscall
>  	.ent syscall
> 

__start is used by the default binutils linker script for MIPS. For a
test you could simply do a "make malta_defconfig", enable CONFIG_API via
menuconfig and build. Without this patch you'll get:

$ /opt/gcc-9.2.0-nolibc/mips-linux/bin/mips-linux-readelf -s
examples/api/demo | grep __start
    64: 80200700    16 FUNC    GLOBAL DEFAULT    1 __start

But with this patch __start will now an unresolved symbol:

$ /opt/gcc-9.2.0-nolibc/mips-linux/bin/mips-linux-readelf -s
examples/api/demo | grep __start
    19: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __start


But I'm not sure if the original intention was to use the default linker
script or the one provided by U-Boot and if examples/api/ should use the
same compiler and linker flags as example/standalone/. Some archs have
used a custom linker script. Maybe Wolfgang knows more?
Wolfgang Denk April 23, 2020, 8:43 p.m. UTC | #3
Dear Daniel,

In message <aad059da-bc2c-c991-4599-54c47a350dc8 at gmail.com> you wrote:
>
> But I'm not sure if the original intention was to use the default linker
> script or the one provided by U-Boot and if examples/api/ should use the
> same compiler and linker flags as example/standalone/. Some archs have
> used a custom linker script. Maybe Wolfgang knows more?

Sorry, I can't remember resp. I think I never knew.

Best regards,

Wolfgang Denk
diff mbox series

Patch

diff --git a/examples/api/crt0.S b/examples/api/crt0.S
index 57bba9d851..2f75f5a036 100644
--- a/examples/api/crt0.S
+++ b/examples/api/crt0.S
@@ -42,12 +42,12 @@  syscall:
 #elif defined(CONFIG_MIPS)
 #include <asm/asm.h>
 	.text
-	.globl __start
-	.ent __start
-__start:
+	.globl _start
+	.ent _start
+_start:
 	PTR_S	$sp, search_hint
 	b	main
-	.end __start
+	.end _start
 
 	.globl syscall
 	.ent syscall