From patchwork Sun Feb 18 19:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Campos X-Patchwork-Id: 202875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp928929dyc; Sun, 18 Feb 2024 11:52:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVH9Ia3L2KC81VlQJrcdOKJiiPW0BLP6ydB8j63HTzcuecc+Mfr4c2wgLuI2tTE3eraLekxq9/f7NOZQbc505KW2wdAvA== X-Google-Smtp-Source: AGHT+IHV6hTl644GqgD7teovueixj0+iiJLP0GYtZV0XtKjpNrlAF50/Q2g37d7q6fHuq+l8o3B8 X-Received: by 2002:a05:6358:d18:b0:176:40fb:e123 with SMTP id v24-20020a0563580d1800b0017640fbe123mr11976650rwj.5.1708285938483; Sun, 18 Feb 2024 11:52:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708285938; cv=pass; d=google.com; s=arc-20160816; b=hCO4zT+6Azv7avjskJftww9Kpdis2VOEWi/2VUcR1GODP+mu66IFEvO4OtALwy71qC BvdTQX7B/XHtJsWXsG9jQu4UM2C9H5qTv94E9PCQkwu+HWswLAarF+XaiS+7HsHnJgTk SW1OurnMsI4UfaoxWVuUC72s6PXM+DeKy2CJMe6VKQK+6ROxfwnNw4HoNenYvYNvS/GI TdEiOMAveYBdS2nyIvZH4KbKNSiYV+xqsBz9bfumHOiwEWlF7J43z7bcNjuwx4ehn+6I 4uO4YQnoFRHLVQ5KWh8IV+lyC10eTEHhI3SpaCgwwa0uUX07CwFGYua1tdKG2PJ0Hy1e mWwA== 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=HmbJMSA+rDrUIPzrZfECGQfunbWYzs60GG/4g7pvyeo=; fh=1pO/fnqlbA1DlSshLp2Kp23nBXobkeZ558bQEuNU3Z8=; b=RmmYAFVrPVuUbOGjKbFlbTuEsa24dKWt7oMe3m/vmhgjS1Vwmo8v7Ilez/+Q/blmYr ANVDV3jaD4CF9inherrz3qQo3V5ccG1EpPAGiCDqOgjDfo9APyDUiJBxj4or7fqzqfBV SF560IiQKrspkfh9R/XfUgOH+FR3x5kKOtII7nxYmbsq/Dj+2Fdb6kN4/f8U6ZMLcco0 YKC4dum1yynbHcNUOgQx6MXPZjyuBjd66qr+ot7MiPvn0hRiY2GOwLsv6Ww0SR6PBdPK gDkJXXEhYBsv5biD5Vy5kliLtffnYRpGXN7yml0RGVR9jbKbTChLQAheV5NZiykmbI4Q pslw==; dara=google.com 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-70558-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70558-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 a18-20020a17090ad81200b00296a72882c4si3311947pjv.74.2024.02.18.11.52.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:52:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70558-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-70558-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70558-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 9F541B212EA for ; Sun, 18 Feb 2024 19:52:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BFE17317E; Sun, 18 Feb 2024 19:51:37 +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 8366A6F53E for ; Sun, 18 Feb 2024 19:51:33 +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=1708285895; cv=none; b=UVoghnq1iGkqkB884zZRC3xMY+PrcHV4ZKOyWvAGk/CGlMmzJlMLSuoZSVC4yFWMMKG2bJbmd8FJrNsMbLh2qn6xMV0xNfjVBIgeItFPp7027ST0F5B2mR9yyv/zca7f0OoKglqFSrVZHl0fL2Ky3lfFRWpImkC6iKrn+E+sBnk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708285895; c=relaxed/simple; bh=yW/KTPvl1LdQSw2p4A5TjI0BdCEzeZVKTkHAyd72DpQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fy7oajpEZ+ggijQDl4MUE9/+W8Ir4XcYPGwkCybtYpivfD2quvroAihH7dBHxJjyzctajASarJozLUVQuozLrIR+F9y6iLSOHrtfBa6FmF1fG3TXbEmPAYNB2RjUVE5GO/dHtsrAXKw2zkQGvel4RZ+RVQQyd5AI7IsNoXV0/hg= 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 lindsay.fibertel.com.ar by sdfg.com.ar (chasquid) with ESMTPSA tls TLS_AES_128_GCM_SHA256 (over submission, TLS-1.3, envelope from "rodrigo@sdfg.com.ar") ; Sun, 18 Feb 2024 19:51:31 +0000 From: Rodrigo Campos To: Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Cc: linux-kernel@vger.kernel.org, Rodrigo Campos Subject: [PATCH v3 1/4] tools/nolibc/string: export strlen() Date: Sun, 18 Feb 2024 16:51:03 -0300 Message-ID: <20240218195110.1386840-2-rodrigo@sdfg.com.ar> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218195110.1386840-1-rodrigo@sdfg.com.ar> References: <20240218195110.1386840-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: 1791267636109897266 X-GMAIL-MSGID: 1791267636109897266 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 -static -o test test.c /usr/bin/ld: /tmp/cccIasKL.o: in function `main': test.c:(.text.startup+0x1e): 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;