Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp444394rdb; Sat, 27 Jan 2024 13:28:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFX4/yeBMgLb5yvKIh0yJ37LML27C9YmM9uuYRWRY9oivxUd+1pgjqM085cyauyfYzDXUW X-Received: by 2002:a9d:6b04:0:b0:6dd:d5c4:fb02 with SMTP id g4-20020a9d6b04000000b006ddd5c4fb02mr2680085otp.68.1706390900313; Sat, 27 Jan 2024 13:28:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706390900; cv=pass; d=google.com; s=arc-20160816; b=m7gdqU1N0bNFSyA5zdeSrOzLLaZ29rDwXjDGc+k14cdbP5EUmpiRS/QcxBdf4mykFS 0m8Jgh7MMX9vtOqupvJca6dN1PteNu+1/anHeND3D24O65Dm9mZs59OPQjZKRzTb+M4D x16bkVv9I8anvPtUHjy5+q1xXt0diWtQR0rbW/aJ227zef8WzVLmj5P0gKvfMgNA6oyB Cv2heLzkQTgjNMJmm/eIkDgSHJbKuaO3jA9cTmu3quCBu91XnNrzms3npypVq6w/juX8 pxAp6Y0NLnLp4aTBZDyPN88C6PD1oJR2ePZ4PsV/mQnXroxEPYcR0pVKrN1ukR7VmAoa ED/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=ONQkk+QNxqOpnWfjjREp4EBIdDSAI3PhNbaheArs/c8=; fh=exmWi2XKDoEd8IdJMsBZb0an4XMDp1euaxUAALdZjDc=; b=xCwzh2WO1MQEy8I5KDd1qlwsp0z6rcrw+C6h3JciRaglfabA2eVtKcvG+b6IkG+2df cJnSwrOcwE0366JurUJx+WeGRqeXI3yVfxTPcw6kTPnE7cstrRZTLUo3dvozC1ZEBjws iH8kLCcZ0bVCYMhlKj6oWsenbwv6tYqcbts9Wz0UYjFQxRORWbUX8Ho9DIF4TYpfR12p jG/Axnzn+2wDpJYUsQrLpsMTrQJJCb7nR3DAewNDhu7BR3p8BcgYMX51QmF9D4Rg+vju 7WZ1YJnUkAPs6AlMK/0Q4MDsK54lN0c7q48asyzg7Hes/Oc0hIq8h8T8B0r8o79W/euh 7tOw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-41403-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41403-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z15-20020a63190f000000b005cdfcb3908bsi3283052pgl.316.2024.01.27.13.28.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jan 2024 13:28:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41403-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=1wt.eu); spf=pass (google.com: domain of linux-kernel+bounces-41403-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41403-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 35A0428495F for ; Sat, 27 Jan 2024 21:27:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E86C51B278; Sat, 27 Jan 2024 21:27:37 +0000 (UTC) Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F105418EA8 for ; Sat, 27 Jan 2024 21:27:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=163.172.96.212 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706390857; cv=none; b=szz0eGJUodBQ5BbLzeUreRvj1CFxqfOaAHD21mPxHxNyrVZfg/iAveDF/1Lm0COyNkfKLlT/mQK5vMwV9QFTvWJbRCV+TaapXHYp5Xazl4cNSctT74aBkEcrQ1a4C+xvRUdK/jDQR4LfePcSeKRamb0Je84jhVlCXmMO36SzrmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706390857; c=relaxed/simple; bh=9KwBhvtglN+6x4oYF2Z8Be3dzjV+mgnD23CoYh9dLSk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UzvNiMk4BTeTAgQulEiHkdooG5d99S49t1ZR6vqLXQLbqWR/LhtGLJUCnI5LzfYJUgRcEAIdeLE82YD7Bnk/Q5+N5PtUglETmbGYTwDP1C+H7sHmrfbd0AOJUZ7wHGsqI8WPwUaEdHlt7SYOuCQD/CoYLMA+pFEodFbd40oKsYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; arc=none smtp.client-ip=163.172.96.212 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 40RLRS8Y014852; Sat, 27 Jan 2024 22:27:28 +0100 Date: Sat, 27 Jan 2024 22:27:28 +0100 From: Willy Tarreau To: David Laight Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Rodrigo Campos , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 0/1] tools/nolibc/string: export strlen() Message-ID: <20240127212728.GA14846@1wt.eu> References: <20240126142411.22972-1-rodrigo@sdfg.com.ar> <9abed5e3-cd61-474e-bb16-13243709f5c5@t-8ch.de> <20240127162400.GA14079@1wt.eu> <512849f3c22e4f4688c20fabe017c903@AcuMS.aculab.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <512849f3c22e4f4688c20fabe017c903@AcuMS.aculab.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Sat, Jan 27, 2024 at 09:23:01PM +0000, David Laight wrote: > .. > > Yes, once we have the proof that the compiler may produce such a call, it > > can also happen in whatever user code so we need to export the function, > > there's no other solution. > > Does that mean that it you try to implement strlen() in C > gcc will generate a recursive call? Yes, that's exactly what happened the first time with strlen() itself! > I guess an 'asm volatile("");' in the loop fix it. That's how we fixed it for strlen(). The problem I'm having with addressing it this way is that as long as the compiler will decide to emit calls to strlen() which was not explicitly referenced in the code, it will still be missing and will continue to fail. Thus the safest solution is to make sure strlen() remains accessible in case the compiler decides to make use of it. Willy