From patchwork Fri Jan 26 14:24:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Campos X-Patchwork-Id: 192628 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp703633dyb; Fri, 26 Jan 2024 06:44:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNumkPRJXIH9+amUR7Ak8ujfXISQVvzW3DhoPpZ8SSkR4ljvGxaPw6GcXwoAmSqR8110vI X-Received: by 2002:a05:6a00:1954:b0:6d9:955a:d3bb with SMTP id s20-20020a056a00195400b006d9955ad3bbmr1321114pfk.10.1706280247876; Fri, 26 Jan 2024 06:44:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706280247; cv=pass; d=google.com; s=arc-20160816; b=j4YrVhCYstotwTreplfaj/FaShEGRM8NhLUjOsLpvcKpPnJifyvF3NdLUK+3QVNBln Dh2Qvq43QkJ4SxSCvDRnBMGzsgNboQJPxSimj4uT/zIFpu6osX8m4BZJLkIkvVYRgU2Y 0zS4mO+WYDr6gtuFjmA6jEvJTCXqMQ1Kmz6i4Y2jH00G0pkcGlKWTLmX02vMazywe/vW 8rowm+nLYplLBrWzAWTnA9XPm4mUfcHELHIIY6WgXgntJ7sac1B+J29UR3+OhRcAEzUo 8R4SnPhIwyX2nprmDgPZATC2FzWp4SHr+CBFMYv/Sf39fKpQi+1U95FsBG6aBNh5p/0I gyKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=3GhpWbT+DVuI2XMrWa4VPJXyw8jKGYBNrbmYWNZwPFA=; fh=1pO/fnqlbA1DlSshLp2Kp23nBXobkeZ558bQEuNU3Z8=; b=tzpBXSrt+QQpve/RHFzZ7yq/qq9YpjRae8GRLF+Vf+1flKF7sfnorqQ2/zJhLI28e/ HomFo9BDyttAZlaHyvedBU6yCVbQk1x/kkD+D1xRj5R2YrsbOtMjiyBxszOXGUL18yy2 LmEflLNSCZtQae1alvcdpkAvP584lE4UWfoSAsm5/Uvxs2Aba6X6zWA/F1Q2OduYHggD 0L07PQVIu2LHalkhbxv3tnjtNl2lckMdYnA4kCQlXlZ6z+XBYx/xDMvUZ5RFKEieEtHM /26Op9VlJ4PwR/pzK77SoDApKO/MvGNt3HvAZGNndfrng0iJ6uVuMzx38TCyVG08axA0 CpPg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sdfg.com.ar); spf=pass (google.com: domain of linux-kernel+bounces-40177-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40177-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id jw16-20020a056a00929000b006dbcc2013aesi1286995pfb.137.2024.01.26.06.44.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:44:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40177-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sdfg.com.ar); spf=pass (google.com: domain of linux-kernel+bounces-40177-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40177-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7D3A0B27545 for ; Fri, 26 Jan 2024 14:27:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 062E51C6B4; Fri, 26 Jan 2024 14:25:33 +0000 (UTC) Received: from alerce.blitiri.com.ar (alerce.blitiri.com.ar [49.12.208.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BBE61D556 for ; Fri, 26 Jan 2024 14:25:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=49.12.208.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279131; cv=none; b=dQgKhnijdb9k0hWuIZSgZvIXsF8/sg/5Vmycr3l9KUlgFdSkJmEr1Hot+LTec+rUeZIz1TzW3TRRKIw3rQrVW+dLR/OFof1R74badSBh3Lr/FyV2R0rVrOx9rW+8b0IMLRrUHTAHLCWj/bP0gt0lfOYOWS9vY982TfDXWujFSVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279131; c=relaxed/simple; bh=sbhZ/NdHAucnYQnxUho3gN2gMhD/hGaKGFKuXYzPsA8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uM5y9RNOHrGHKmpcybsVOio5KThJpKKOo+vdm1ev56h2+PvL6p+n56oSwKChtQB/s6XtiFWdfrTrMsoqY3zmW/fUGwnJttRiwFWf0ZHbJZl0igQzEp5sSqWLYUmzcoMQs7+TK4iHYs4EFvTk1wU4J7lTAy1Lrct3kJNmdnEoMiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sdfg.com.ar; spf=pass smtp.mailfrom=sdfg.com.ar; arc=none smtp.client-ip=49.12.208.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sdfg.com.ar Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sdfg.com.ar Received: from localhost.localdomain by sdfg.com.ar (chasquid) with ESMTPSA tls TLS_AES_128_GCM_SHA256 (over submission, TLS-1.3, envelope from "rodrigo@sdfg.com.ar") ; Fri, 26 Jan 2024 14:25:25 +0000 From: Rodrigo Campos To: Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Cc: linux-kernel@vger.kernel.org, Rodrigo Campos Subject: [PATCH 1/1] tools/nolibc/string: export strlen() Date: Fri, 26 Jan 2024 15:24:11 +0100 Message-ID: <20240126142411.22972-2-rodrigo@sdfg.com.ar> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126142411.22972-1-rodrigo@sdfg.com.ar> References: <20240126142411.22972-1-rodrigo@sdfg.com.ar> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789163547151258888 X-GMAIL-MSGID: 1789164517156695831 As with commit 8d304a374023, "tools/nolibc/string: export memset() and memmove()", gcc -Os without -ffreestanding may fail to compile with: cc -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib -lgcc -c test.c -o test.o cc test.o -fno-asynchronous-unwind-tables -fno-ident -s -Os -nostdlib -lgcc -static -o test /usr/bin/ld: test.o: in function `main': test.c:(.text.startup+0x32): undefined reference to `strlen' collect2: error: ld returned 1 exit status As on the aforementioned commit, this patch adds a section to export this function so compilation works on those cases too. Signed-off-by: Rodrigo Campos --- tools/include/nolibc/string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h index a01c69dd495f..ed15c22b1b2a 100644 --- a/tools/include/nolibc/string.h +++ b/tools/include/nolibc/string.h @@ -123,7 +123,7 @@ char *strcpy(char *dst, const char *src) * thus itself, hence the asm() statement below that's meant to disable this * confusing practice. */ -static __attribute__((unused)) +__attribute__((weak,unused,section(".text.nolibc_strlen"))) size_t strlen(const char *str) { size_t len;