From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by sourceware.org (Postfix) with ESMTPS id 064E73858417 for ; Mon, 6 Feb 2023 13:09:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 064E73858417 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-163bd802238so15041739fac.1 for ; Mon, 06 Feb 2023 05:09:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=9M5j2vAP1oX5M9lqCGS2qGyG8+fLk5l7QgGUwuvmu1o=; b=JOYe67FhequwxIFKXuoFPetJPfzneGANJT74Mfl08nwRIyliGS77j1ZCjvIBLnC0o0 Vzp2uEik7OBEGG3HB3dCs/NNMZEXwdI73SOS5dPIOHrVhgc55Eb4efHA3v1X1aXFjYjy j4g285FusvN1FRs9BLDPvlrTLk6zNsRMVpicwLL18xiSG3KxVhKWBNzgWFbKEQBCCHFi +jmXQfNuCeVDP1OjoagGvPiwnkO8wv6nJjZI9OZn5BNPuqxya/wf01eJzZR0zIXaGZy0 IsC0e9TrY5CK133tv8lkwncEFsF8EDGHkumgO/mnP1TKZpNAjT3+vwp+sOdLo6Mr/Q/a OY0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9M5j2vAP1oX5M9lqCGS2qGyG8+fLk5l7QgGUwuvmu1o=; b=7apgMQBOh0WAddsuhcZ2CySKtkEqZ9TBOj7+K8CHXKRFrUvUv2oayvTFbBdVfF+rW1 tcOddkzhOd0GCXgCaRZcEv0JgIX+zvJ5Z4pBIv1XHmYErW01PccCSl1FhpR8N/iO5w9K WEQ65HF9AlUzlIzlF8Iukt3xPQhlGDoUIfiH2km+rAW1SzMpjBQSsylHVDv8NkVEjgD0 stCiW21RAvnpbLHa/MQcFVyb3flaJWC5u1Nxq6vA0HQboofxo1ktB9d+OLfCt/pOzizx 6GRt5bNw7bTeuGMJr37bcOQtpDrbxA9sgoKSvZHE+6U1/l9Z8Gq2anysVF+L10RjzQBN Lb/w== X-Gm-Message-State: AO0yUKXbsUE4z0kpXJAw0KbShuHohSnemHnHHY6Ae6HbswDAlBW6Q9ks N+stCXrbcgk2+kNoruD5V60PiA== X-Google-Smtp-Source: AK7set8Wl7sMH9lCVPfOf8ld+tsqtH0qSiJhX6t4b77fwA3/o4H8zeu3i2MMd6SaFvXjV7gBMTu+BA== X-Received: by 2002:a05:6870:b48d:b0:163:92b4:175b with SMTP id y13-20020a056870b48d00b0016392b4175bmr12184946oap.40.1675688955128; Mon, 06 Feb 2023 05:09:15 -0800 (PST) Received: from [192.168.15.100] ([177.103.113.134]) by smtp.gmail.com with ESMTPSA id n38-20020a056870822600b00155ffbdbaffsm4113051oae.18.2023.02.06.05.09.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Feb 2023 05:09:14 -0800 (PST) Message-ID: <5443bec7-9cbb-2f6f-98c1-1c016fbfbb92@linaro.org> Date: Mon, 6 Feb 2023 10:07:55 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v12 06/31] string: Improve generic strchr To: Richard Henderson , libc-alpha@sourceware.org, Jeff Law , Xi Ruoyao , Noah Goldstein References: <20230202181149.2181553-1-adhemerval.zanella@linaro.org> <20230202181149.2181553-7-adhemerval.zanella@linaro.org> <631597d6-89d3-3748-11e2-4b5ef6238978@linaro.org> Content-Language: en-US From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <631597d6-89d3-3748-11e2-4b5ef6238978@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 03/02/23 23:58, Richard Henderson wrote: > On 2/2/23 08:11, Adhemerval Zanella wrote: >> New algorithm now calls strchrnul. >> >> Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu, >> and powerpc64-linux-gnu by removing the arch-specific assembly >> implementation and disabling multi-arch (it covers both LE and BE >> for 64 and 32 bits). >> >> Reviewed-by: Richard Henderson > > strchrnul needs libc_hidden_builtin_proto.  On riscv64: > >    8:    00000097              auipc    ra,0x0 >             8: R_RISCV_CALL_PLT    __strchrnul >             8: R_RISCV_RELAX    *ABS* >    c:    000080e7              jalr    ra # 8 <__GI_strchr+0x8> It is similar to x86_64 as well: x86_64-linux-gnu$ objdump -dwr posix/execvpe.os [...] 234: 4c 89 ff mov %r15,%rdi 237: e8 00 00 00 00 call 23c <__execvpe_common+0x12c> 238: R_X86_64_PLT32 __strchrnul-0x4 [...] But the static linker ends up generating a local call as expected: $ riscv64-glibc-linux-gnu-objdump -dr libc.so [...] 000000000008726e : 8726e: 7179 addi sp,sp,-48 87270: ec26 sd s1,24(sp) 87272: 000e9497 auipc s1,0xe9 87276: 4264b483 ld s1,1062(s1) # 170698 <__stack_chk_guard@GLIBC_2.27> 8727a: 609c ld a5,0(s1) 8727c: e43e sd a5,8(sp) 8727e: 4781 li a5,0 87280: f022 sd s0,32(sp) 87282: f406 sd ra,40(sp) 87284: 842e mv s0,a1 87286: 02a000ef jal ra,872b0 [...] The intra PLT should trigger a regression with make check local-plt test, and I did a make check for all architecture to make sure I am not missing anything. I will send a patch to fix this internal inconsistencies.