From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by sourceware.org (Postfix) with ESMTPS id 5E9513858C54 for ; Wed, 5 Oct 2022 18:06:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5E9513858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-xf34.google.com with SMTP id i12so10975172qvs.2 for ; Wed, 05 Oct 2022 11:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=W6+LLt0j9oI7ncCeipG+5ytZEvxrkfjrYzjInDXlX5c=; b=BHrDfj5FdCHd75ZdVUfcpZtzuAiek5or+UmB4P2LA9qx68EiThwvteYyemUvqbI7v5 3u3DM4Kf3CO9UqlEVQWqAwuhX7t1ruY9ItT052SPf80fmn8ugAUmNZNZbMkIuIUSxoy/ ZNDS238ZQdihxsa6doYa6KVWGPiO/B2BA3bgsitYohsmL4CjWTepjWUeSsCLiNv1VlqE P3nJa03luiaXixAXk2w3H/fJI3P8WIpAVaEX7jP8CHUYNXT1B9AzHyhB5BphwLOiVJX3 KSt4w9AbZwq+XzjXqitZ6FDNG6PunGhj+WC1wHKDsyBxWI+09zusHJTsK8QuyHdRyr3Q Kk9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=W6+LLt0j9oI7ncCeipG+5ytZEvxrkfjrYzjInDXlX5c=; b=lnUc2A3Um6simnRxJFrFK1wyRGkJjaMdoZujEdJdLfkrb7udA4PIks7dj8LaYMP3wL IcDhbH0cmYWrehfjgcM2Ow/taoibJAiKeo1nvX5Hu1kUaWfgzzXZplAwXgfOfVWdreIz UmeVreYpGuJY0K6lKHg5PEaWuhA+wsGET1non3jKw+lKisf3gBhzs06N8E2EIMkFtF6I M7SBoLRIy4DXyCA8r/6xz5T/WpYqIRvFCwRUWRuFTkm6jFQEahMl7aZMEN+3JF/1GgAk L5WDBCAJ9r75tVop2XzkDwdHbxcxW1tSBsheKOIIbXei736giaAsSxdd9scPA6Pzzr9q +FtA== X-Gm-Message-State: ACrzQf157pZKchZiuYumk2DQljjvgeNgkGFsWZCuQ0p3esJv9cWsDFxA knf4L//LOMmbH+qU5DmoFyQsUE3EJxG0NjwqJbE= X-Google-Smtp-Source: AMsMyM4KUEQEK+MCxpgW1QgP2nJM+h1TSi2UnJmb0Hq44iTwOoM7Ed6AKWJT7l1KtgmT7wO5ihwLqLVM4fo83ZBUnIk= X-Received: by 2002:a05:6214:d0e:b0:4ad:5e35:329a with SMTP id 14-20020a0562140d0e00b004ad5e35329amr784894qvh.28.1664993212623; Wed, 05 Oct 2022 11:06:52 -0700 (PDT) MIME-Version: 1.0 References: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> <20220921135108.3324737-7-adhemerval.zanella@linaro.org> In-Reply-To: From: "H.J. Lu" Date: Wed, 5 Oct 2022 11:06:16 -0700 Message-ID: Subject: Re: [PATCH 6/6] x86: Fix -Os build (BZ #29576) To: Adhemerval Zanella Netto Cc: "Carlos O'Donell" , libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3024.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham 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 Wed, Oct 5, 2022 at 10:38 AM Adhemerval Zanella Netto wrote: > > > > On 05/10/22 14:21, H.J. Lu wrote: > > On Wed, Oct 5, 2022 at 7:10 AM Carlos O'Donell wrote: > >> > >> On Wed, Sep 21, 2022 at 10:51:08AM -0300, Adhemerval Zanella via Libc-alpha wrote: > >>> The compiler might transform __stpcpy calls (which are routed to > >>> __builtin_stpcpy as an optimization) to strcpy and x86_64 strcpy > >>> multiarch implementation does not build any working symbol due > >>> ISA_SHOULD_BUILD not being evaluated for IS_IN(rtld). > >> > >> Ohhhhhh... that is interesting. This changes the strcpy used in rtld for > >> all x86_64 build options, and I'm going to ACK this, but we may need to > >> revisit this if it shows up in a profile. > > > > Will this lead to both strcpy and stpcpy in ld.so? Currently there is only > > stpcpy in ld.so. > > I think that is expected behavior if compiler creates a reference for a > supported string function in the loader (rtld build pulls the > implementation). strcpy is only generated in dl-profile.os: text data bss dec hex filename 2716 0 72 2788 ae4 dl-profile.os (-O2) 2265 0 72 2337 921 dl-profile.os (-Os) 1840 0 0 1840 730 strcpy.os Should we compile dl-profile.c with -O2 with CFLAGS-dl-profile.c += $(if $(findstring -Os,$(+cflags)), -O2) It will create a smaller ld.so. > > > >> CC'ing HJ here in case he wants to comment as a machine maintainer. > >> > >> LGTM. > >> > >> No regressions on x86_64. > >> > >> Reviewed-by: Carlos O'Donell > >> Tested-by: Carlos O'Donell > >> > >>> Checked on x86_64-linux-gnu. > >>> --- > >>> sysdeps/x86_64/multiarch/rtld-strcpy.S | 18 ++++++++++++++++++ > >>> 1 file changed, 18 insertions(+) > >>> create mode 100644 sysdeps/x86_64/multiarch/rtld-strcpy.S > >>> > >>> diff --git a/sysdeps/x86_64/multiarch/rtld-strcpy.S b/sysdeps/x86_64/multiarch/rtld-strcpy.S > >>> new file mode 100644 > >>> index 0000000000..19439c553d > >>> --- /dev/null > >>> +++ b/sysdeps/x86_64/multiarch/rtld-strcpy.S > >>> @@ -0,0 +1,18 @@ > >>> +/* Copyright (C) 2022 Free Software Foundation, Inc. > >>> + This file is part of the GNU C Library. > >>> + > >>> + The GNU C Library is free software; you can redistribute it and/or > >>> + modify it under the terms of the GNU Lesser General Public > >>> + License as published by the Free Software Foundation; either > >>> + version 2.1 of the License, or (at your option) any later version. > >>> + > >>> + The GNU C Library is distributed in the hope that it will be useful, > >>> + but WITHOUT ANY WARRANTY; without even the implied warranty of > >>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > >>> + Lesser General Public License for more details. > >>> + > >>> + You should have received a copy of the GNU Lesser General Public > >>> + License along with the GNU C Library; if not, see > >>> + . */ > >>> + > >>> +#include "../strcpy.S" > >> > >> OK. Uses Makeconfig:sysd-rules-patterns to capture rtld-*. > >> > >>> -- > >>> 2.34.1 > >>> > >> > > > > -- H.J.