From nobody Mon Feb 9 05:29:49 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 959491946C7 for ; Mon, 12 Aug 2024 20:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495829; cv=none; b=gL/1NnLF/uZdsP1K052fCGiYxN1J0hbJFrcrnVXe8QhXsETTu/Y2/8KXKtk9jf+rbdPQyLgm6H2N/ULMuihQrkO43jN1imMwkELRO/WjEW4TU7owuEtrLQQMWacP4++JyoUZrgJ1xyWU12xbymH0F984K0znPZuDm4LFCYPJE94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495829; c=relaxed/simple; bh=ZNeFBu2r+MPt0NFXyubnSviQFodwSXA7ecOazzdipzI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mE9DAAwe28OMR5DjYMYfeEuqcyoTmZ9m+e/ououiPYiDArgS/dVk0cSdspMntMeToe6w8y37GQXJPbfAFVN8nf5R/Rcptt1LHAP2fT6IizZ9ApNr2QIcAJ+QePvDaT8dd2RSk0Y5Ys3Gq6J8ls5k9PBBwm6Mro5J1BF+TOR9t5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=JFngCM9k; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="JFngCM9k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1723495825; bh=ZNeFBu2r+MPt0NFXyubnSviQFodwSXA7ecOazzdipzI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JFngCM9kl6nySRjgm5DallTnL2GSYHDADB8arPNiLVbi23HQApOyI8TO9KehskfK/ Z5GOOSrMNVhzeaKl+eOSbiHh1W5yooMD0ZorTcuvF/rRdK3clrz/TyHM7uvu0J0QFE ayj7OadDb0cniWvDvF7ZoRom5zOBlFAbiRYu2pU4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 12 Aug 2024 22:50:17 +0200 Subject: [PATCH v2 1/3] tools/nolibc: crt: mark _start_c() as used Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240812-nolibc-lto-v2-1-736af7bbefa8@weissschuh.net> References: <20240812-nolibc-lto-v2-0-736af7bbefa8@weissschuh.net> In-Reply-To: <20240812-nolibc-lto-v2-0-736af7bbefa8@weissschuh.net> To: Willy Tarreau Cc: Ammar Faizi , linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723495824; l=912; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=ZNeFBu2r+MPt0NFXyubnSviQFodwSXA7ecOazzdipzI=; b=P2xx4qaKTCNzu9ebCHiJR1m5SdUzV/UC7fKa728DAjj7geenVVmJgtYa1FPzTvN9OgMaqRhlf mkSJzXIbuy3CFc/Zo/17qVdSGplWEXlq9jGW0cJqzfR0Y9wQ610j+jw X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= During LTO the reference from the asm startup code to the _start_c() function is not visible and _start_c() is removed. This will then lead to errors during linking. As _start_c() is indeed always used, mark it as such. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau --- tools/include/nolibc/crt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/crt.h b/tools/include/nolibc/crt.h index ac291574f6c0..bbcd5fd09806 100644 --- a/tools/include/nolibc/crt.h +++ b/tools/include/nolibc/crt.h @@ -22,7 +22,7 @@ extern void (*const __init_array_end[])(int, char **, cha= r**) __attribute__((wea extern void (*const __fini_array_start[])(void) __attribute__((weak)); extern void (*const __fini_array_end[])(void) __attribute__((weak)); =20 -__attribute__((weak)) +__attribute__((weak,used)) void _start_c(long *sp) { long argc; --=20 2.46.0 From nobody Mon Feb 9 05:29:49 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEF79194AE6 for ; Mon, 12 Aug 2024 20:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495830; cv=none; b=UrKtYZfcemoVLpo9oGSFHSUmX0H/+8+ib7ta4R0vOpQgIXyEsCYCrmKHfzj539ov921+RtNvU/YeGtxKg10p9rLFhDNzS/ocyAfrtKW/jKqH9JYpvmiZym88kOqUTTp6GL7RjiAUaGTbCnpPNf30VLelzh5y69/QWAUV/b4I8hI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495830; c=relaxed/simple; bh=/6UR9g86XgMBxrxchwxIH+6QiNLYmtw9EUkdltAltxY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=f7ESdU6ssgTVtwpVWlf55062ZXrTKoi0HTFnFsSiHcl2K1ZRElUVakNbbCc4IBeNWEy4XxpHMxZhe6rvmBEsYabYuVbFPZ5vqkk/dLGps2oC4GUQOu2IkIcIDLiTNxTTXYq1zVNqAwrJzMKLYOE9VTkWGoSHXn5Po9n9Svgedv4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=SVjhD+ox; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="SVjhD+ox" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1723495825; bh=/6UR9g86XgMBxrxchwxIH+6QiNLYmtw9EUkdltAltxY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SVjhD+oxE/Z6fpR8Qx6Odbc9QLFZ7aEky5n+RMi/ATgcjwu6fH/2xOrVe/J8rYKXC 3p9HR/6Y/BtrvtbjBiNQnWK75DCL98wxN/IiqyhJXnHUYm5nJFQAF4zOnHCprD/BVX XZbRPBXm9YhUPA8nUHpMsxkLjr8XlJYvpMk4YrOU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 12 Aug 2024 22:50:18 +0200 Subject: [PATCH v2 2/3] tools/nolibc: stackprotector: mark implicitly used symbols as used Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240812-nolibc-lto-v2-2-736af7bbefa8@weissschuh.net> References: <20240812-nolibc-lto-v2-0-736af7bbefa8@weissschuh.net> In-Reply-To: <20240812-nolibc-lto-v2-0-736af7bbefa8@weissschuh.net> To: Willy Tarreau Cc: Ammar Faizi , linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723495824; l=1268; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=/6UR9g86XgMBxrxchwxIH+6QiNLYmtw9EUkdltAltxY=; b=OD+HTIBp9LlVZswB1833xxThdDWP2wtxNi66W2sfbN9yEPVKPWJgY9pm+/q5qobQfGg8sd9+k ob2SecVeRygA9/Qp0BjaY2bSfhhYT5wU0WGl7rviZlUocaX8cllqt/M X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= During LTO the references from the compiler-generated prologue and epilogues to the stack protector symbols are not visible and the symbols are removed. This will then lead to errors during linking. As those symbols are already #ifdeffed-out if unused mark them as "used" to prevent their removal. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau --- tools/include/nolibc/stackprotector.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/stackprotector.h b/tools/include/nolibc/s= tackprotector.h index 13f1d0e60387..1d0d5259ec41 100644 --- a/tools/include/nolibc/stackprotector.h +++ b/tools/include/nolibc/stackprotector.h @@ -18,7 +18,7 @@ * triggering stack protector errors themselves */ =20 -__attribute__((weak,noreturn,section(".text.nolibc_stack_chk"))) +__attribute__((weak,used,noreturn,section(".text.nolibc_stack_chk"))) void __stack_chk_fail(void) { pid_t pid; @@ -34,7 +34,7 @@ void __stack_chk_fail_local(void) __stack_chk_fail(); } =20 -__attribute__((weak,section(".data.nolibc_stack_chk"))) +__attribute__((weak,used,section(".data.nolibc_stack_chk"))) uintptr_t __stack_chk_guard; =20 static __no_stack_protector void __stack_chk_init(void) --=20 2.46.0 From nobody Mon Feb 9 05:29:49 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD544194AC7 for ; Mon, 12 Aug 2024 20:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495830; cv=none; b=Eh/nudL6/vtcvnmVISi9nis8StqJ/WUvU+V4L3xoMAUFI8+qoh5hezn/hl1CRrQt0iMBT7zmUfzHery3eaYUJOPvZ0WhYKgfIX/ou+dFy6ZK8kZtDCS8rS/X6fdNV/mwudSU2WVIa0pDVb1Hwx7uvILUm023Ds2fsFSF+7I2T5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723495830; c=relaxed/simple; bh=2ZLl7537lw7Lz84DM7nmys56YoOvTK7dPF+qlWQ7XOo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p0DFNiooW/L8VROa3l9IpRARMpgUQUoYsORngM2N0n0eNuECga7dqxW2gu+BTBOZrq4kEcZekvOpb1/4jhTLFdOEpnx3qtZk1v70letz0XAWkGFOBSbU5BlHEHcQSDE6FaQCVLEvK7XKcEYf6PSJMEf0BC+2HqNAG1c/vNE/3l4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=fmcmtvCY; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="fmcmtvCY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1723495825; bh=2ZLl7537lw7Lz84DM7nmys56YoOvTK7dPF+qlWQ7XOo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=fmcmtvCY2wZtZLZ+NfIthQ0wdyxX9CUz2nlO/8ZBG8RfI+2d4ImYyaHrsLBkUiyWR XdNkLi3Eiv1MJW8VnQeXzSnw6AZPB1Rx3LEuDk15IPtGRId0IKokCZwOdo2mlGORb7 7a95JQE/mPjuJ6L3uAQD32A/pSNuFYPk3xHpSn/U= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 12 Aug 2024 22:50:19 +0200 Subject: [PATCH v2 3/3] tools/nolibc: x86_64: use local label in memcpy/memmove Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240812-nolibc-lto-v2-3-736af7bbefa8@weissschuh.net> References: <20240812-nolibc-lto-v2-0-736af7bbefa8@weissschuh.net> In-Reply-To: <20240812-nolibc-lto-v2-0-736af7bbefa8@weissschuh.net> To: Willy Tarreau Cc: Ammar Faizi , linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723495824; l=1104; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2ZLl7537lw7Lz84DM7nmys56YoOvTK7dPF+qlWQ7XOo=; b=4ZAijgmkXf1uUAE714ImrKHisGPnvNhxxCQ9lMfQApaSk9JKrlMQZhU9Jj3SWQFOfuB/whc1E bTEL+9CeqzvAO28Eh6oIzLKIkh7djcAz0anp+u/FL2egz56a1NVdChK X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Compiling arch-x86_64.h with clang and binutils LD yields duplicate label errors: .../gcc-13.2.0-nolibc/x86_64-linux/bin/x86_64-linux-ld: error: LLVM gold pl= ugin: :44:1: symbol '.Lbackward_copy' is already defined .Lbackward_copy:leaq -1(%rdi, %rcx, 1), %rdi Instead of a local symbol use a local label which can be defined multiple times and therefore avoids the error. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: Willy Tarreau Reviewed-by: Ammar Faizi --- tools/include/nolibc/arch-x86_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/arch-x86_64.h b/tools/include/nolibc/arch= -x86_64.h index 65252c005a30..1e40620a2b33 100644 --- a/tools/include/nolibc/arch-x86_64.h +++ b/tools/include/nolibc/arch-x86_64.h @@ -193,10 +193,10 @@ __asm__ ( "movq %rdi, %rdx\n\t" "subq %rsi, %rdx\n\t" "cmpq %rcx, %rdx\n\t" - "jb .Lbackward_copy\n\t" + "jb 1f\n\t" "rep movsb\n\t" "retq\n" -".Lbackward_copy:" +"1:" /* backward copy */ "leaq -1(%rdi, %rcx, 1), %rdi\n\t" "leaq -1(%rsi, %rcx, 1), %rsi\n\t" "std\n\t" --=20 2.46.0