From patchwork Mon Jan 29 14:15:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Campos X-Patchwork-Id: 193502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp599958dyb; Mon, 29 Jan 2024 06:26:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY6IG4Fkfhw6+4ZHdxnhiwgFmZVsiQ1lxOv4sDYQwQS3EdkHnFX/BLu/4iYfd9XVP/OwNm X-Received: by 2002:a05:6808:11c1:b0:3bd:5347:941f with SMTP id p1-20020a05680811c100b003bd5347941fmr5822769oiv.59.1706538366026; Mon, 29 Jan 2024 06:26:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706538365; cv=pass; d=google.com; s=arc-20160816; b=kMoHygTpf5MfjSJA+HGMixJOOOBhLcOvwf3xiO4rEleGaH8An1lBG7Oj9gAbrX1Bpr 4/e8guoEVksc5Pkc2p/1d6SYLF+B6iORYwOyU4yoOepv0f3yWIjRH27MZ0Wjy5tSmOaz viYV5bpW2AGAxbK2Rge8B04wrO+XWD1RAODinqqlNahjlWCy8oYXP6dRe78XxWds1mEW WF1vA2eTgMcoF9xckLP+Ja4h7w8DChtEqE1IIT0ptEa6ndnvQFM7hwf5EIptEUCItsd+ CkvBl1HeA1U6l48JiHunW9xVcl4Ad6aEfbVyl9fIggd+VdHZy/ujmB4FbME/P9d4Jvkh v8WQ== 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=awykDpTOGxLaBdVQu4HNb6kAtZb2jesb7Q8Z8hXbO1b6XkZla7GnwvuYC+mIq0rGya EvVnSPgB8U0IZCZ79wZ+BdzpKg6epHqjTK72Mx7D2HG/uMHEyJK9wEdAMTQr/3eJYT8o bmEjwn05CbcBKbzI1fLdq6kDSqKQnfLKWP+v+xzxsokGoHSKNDgOpXVtAoFsVLsuuaYS rj69dkdcpWGP2PCku7TjAOYiCdmyur5HXNnq5lfGlCMav/CTViiXiRWRn4lV+i6aTpM9 9o0bPxSb2oep52ip5DLX5f7ic0czsfR9feBX2TN//MSPTtFcpDSOlimcH3wMn2oNu/cL UxMA== 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-42866-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42866-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 q12-20020a056a00084c00b006dbac97dfccsi5927148pfk.141.2024.01.29.06.26.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 06:26:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42866-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-42866-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42866-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 68A99B24783 for ; Mon, 29 Jan 2024 14:16:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71873664C9; Mon, 29 Jan 2024 14:15:47 +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 A815965BA3 for ; Mon, 29 Jan 2024 14:15:43 +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=1706537745; cv=none; b=dWun18TdkVANlsQmrttlaZnfhqt8+C5ie9OcMSPUoi1slDF/3Pj4E0O2Pi5+MYNCFuoq5jzLwbrhSUArs4DGo4u8lY/CA97c/VRYIDFkSE78WwIiwnMOd8NOHNrRtJ/xKXjkGqmSpKppgkfPJ3Y/z2nH4TxApwnC8AvaNSQ3z2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706537745; c=relaxed/simple; bh=yW/KTPvl1LdQSw2p4A5TjI0BdCEzeZVKTkHAyd72DpQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lmyex+tYlzMUwABkBdUm/+QEPSB9z8ZLp3WXLv/c9HIiulODjw6IjhsCs8Mg3ooo7blhzfibQZsuP5M22tyTH5lgM3uJ+Mw0aCAfLoe3mrqUTsMloYl1uNcW4ALTzQdZdYyd8df2vKGJswI9dx/8zOZZeL1/+u16DIM/xUeGQNQ= 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") ; Mon, 29 Jan 2024 14:15:35 +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/4] tools/nolibc/string: export strlen() Date: Mon, 29 Jan 2024 15:15:13 +0100 Message-ID: <20240129141516.198636-2-rodrigo@sdfg.com.ar> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129141516.198636-1-rodrigo@sdfg.com.ar> References: <20240129141516.198636-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: 1789435173701914299 X-GMAIL-MSGID: 1789435173701914299 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;