tools/nolibc/arch: mark the _start symbol as weak
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Feb 2022 16:23:45 +0000 (17:23 +0100)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 21 Apr 2022 00:05:45 +0000 (17:05 -0700)
By doing so we can link together multiple C files that have been compiled
with nolibc and which each have a _start symbol.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/include/nolibc/arch-aarch64.h
tools/include/nolibc/arch-arm.h
tools/include/nolibc/arch-i386.h
tools/include/nolibc/arch-mips.h
tools/include/nolibc/arch-riscv.h
tools/include/nolibc/arch-x86_64.h

index 443de5fb7f54dfd50ed1c1c4cc21b4f7c2cc689f..87d9e434820c6aecdf45cd5d43ec52d2af12d14a 100644 (file)
@@ -183,6 +183,7 @@ struct sys_stat_struct {
 
 /* startup code */
 asm(".section .text\n"
+    ".weak _start\n"
     ".global _start\n"
     "_start:\n"
     "ldr x0, [sp]\n"              // argc (x0) was in the stack
index 66f687ad987f4d2d1199f8bb65df82fcb1a1be13..001a3c8c9ad5e580f68195c482aa744859defc79 100644 (file)
@@ -176,6 +176,7 @@ struct sys_stat_struct {
 
 /* startup code */
 asm(".section .text\n"
+    ".weak _start\n"
     ".global _start\n"
     "_start:\n"
 #if defined(__THUMBEB__) || defined(__THUMBEL__)
index 32f42e2cee2619f82e5552283bffb0e8a1e7a681..d7e4d53325a39922cfc4252df55869f4960d3c91 100644 (file)
@@ -175,6 +175,7 @@ struct sys_stat_struct {
  *
  */
 asm(".section .text\n"
+    ".weak _start\n"
     ".global _start\n"
     "_start:\n"
     "pop %eax\n"                // argc   (first arg, %eax)
index e330201dde6ad587b6765a197969fcdc1bc78099..c9a6aac87c6df918b04ddcdb5194ececc804dc2a 100644 (file)
@@ -190,6 +190,7 @@ struct sys_stat_struct {
 
 /* startup code, note that it's called __start on MIPS */
 asm(".section .text\n"
+    ".weak __start\n"
     ".set nomips16\n"
     ".global __start\n"
     ".set    noreorder\n"
index 9d5ff78f606b7f6e7ec376ee283bf3d3402f3211..bc10b7b5706de300523fd5fb5af90ecba7a469a9 100644 (file)
@@ -184,6 +184,7 @@ struct sys_stat_struct {
 
 /* startup code */
 asm(".section .text\n"
+    ".weak _start\n"
     ".global _start\n"
     "_start:\n"
     ".option push\n"
index 83c4b458ada7bfc4a26985f6ee4d23419cd2b195..fe517c16cd4d98c8ddabd2f46adbbbc31b0e31f0 100644 (file)
@@ -198,6 +198,7 @@ struct sys_stat_struct {
  *
  */
 asm(".section .text\n"
+    ".weak _start\n"
     ".global _start\n"
     "_start:\n"
     "pop %rdi\n"                // argc   (first arg, %rdi)