From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <SRS1=I3BH=kernel.org==mTs8=F2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@gnuweeb.org>
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org
X-Spam-Level: 
X-Spam-Status: No, score=-5.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,
	RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham
	autolearn_force=no version=3.4.6
Authentication-Results: gnuweeb.org; dmarc=pass (p=none dis=none) header.from=kernel.org
Authentication-Results: gnuweeb.org;
	dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=NZm8UEOl;
	dkim-atps=neutral
Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=srs0=mts8=f2=paulmck-thinkpad-p17-gen-1.home=paulmck@kernel.org; receiver=<UNKNOWN> 
Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217])
	by gnuweeb.org (Postfix) with ESMTPS id 3EFAC2492FB
	for <gwml@vger.gnuweeb.org>; Fri, 13 Oct 2023 02:32:36 +0700 (WIB)
Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])
	by dfw.source.kernel.org (Postfix) with ESMTP id 1165561F41;
	Thu, 12 Oct 2023 19:32:36 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8CBC433CA;
	Thu, 12 Oct 2023 19:32:35 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
	s=k20201202; t=1697139155;
	bh=pg4Aqoba2EU/o3cS7KiwqgLXSRgn8eg2p5Eiz67tpcs=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
	b=NZm8UEOl+44DEWZ0QLu7dr6fraJOnu4psSm2sgUqRVrF5C+k9wKoP4R6cCTPWnOev
	 NJAgGMoxg4qD0CrBd1LRiNtUvJAHKdHJ44C93nz0Rz6/59N+U5D8YCbTqPfSAT8c5s
	 g1sqZDPfrBTU1Cuos5QjUTJlrA+wy/wKjLacLafZ0NAkP9fi0SxO4Nk4XHacy8/xms
	 3SBYVUOT/7TqfgGOlTD1Fe/jHBeeYW53NHkJ7KrxWNxz8buzd5NwC5PS8WvcB/djhT
	 Zm6oS/udqDCXjzsawYqKSOnaSYzZTEeuO2On49ROTEh3IoExqdfNZOX4aczNLC4yQl
	 80zh0AazHi4UQ==
Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000)
	id 42B17CE09E3; Thu, 12 Oct 2023 12:32:35 -0700 (PDT)
From: "Paul E. McKenney" <paulmck@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: gwml@vger.gnuweeb.org,
	kernel-team@meta.com,
	w@lwt.eu,
	=?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <linux@weissschuh.net>,
	Willy Tarreau <w@1wt.eu>
Subject: [PATCH nolibc 03/19] tools/nolibc: mark start_c as weak
Date: Thu, 12 Oct 2023 12:32:17 -0700
Message-Id: <20231012193233.207857-3-paulmck@kernel.org>
X-Mailer: git-send-email 2.40.1
In-Reply-To: <b34ce3cf-3fcc-4eb0-a658-229c197455ef@paulmck-laptop>
References: <b34ce3cf-3fcc-4eb0-a658-229c197455ef@paulmck-laptop>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
List-Id: <gwml.vger.gnuweeb.org>

From: Thomas Weißschuh <linux@weissschuh.net>

Otherwise the different instances of _start_c from each compilation unit
will lead to linker errors:

/usr/bin/ld: /tmp/ccSNvRqs.o: in function `_start_c':
nolibc-test-foo.c:(.text.nolibc_memset+0x9): multiple definition of `_start_c'; /tmp/ccG25101.o:nolibc-test.c:(.text+0x1ea3): first defined here

Fixes: 17336755150b ("tools/nolibc: add new crt.h with _start_c")
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/lkml/20231012-nolibc-start_c-multiple-v1-1-fbfc73e0283f@weissschuh.net/
Link: https://lore.kernel.org/lkml/20231012-nolibc-linkage-test-v1-1-315e682768b4@weissschuh.net/
Acked-by: Willy Tarreau <w@1wt.eu>
---
 tools/include/nolibc/crt.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h
index a5f33fef1672..a05655b4ce1d 100644
--- a/tools/include/nolibc/crt.h
+++ b/tools/include/nolibc/crt.h
@@ -13,6 +13,7 @@ const unsigned long *_auxv __attribute__((weak));
 static void __stack_chk_init(void);
 static void exit(int);
 
+__attribute__((weak))
 void _start_c(long *sp)
 {
 	long argc;
-- 
2.40.1