From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id C192C385742B for ; Wed, 5 Oct 2022 21:28:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C192C385742B 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-qt1-x830.google.com with SMTP id gb14so12951qtb.3 for ; Wed, 05 Oct 2022 14:28:16 -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=yMEZT+4ZueM2FZOuf8dldalBV3D6dGyvVOjrtQyx4hM=; b=p6I+moNG3jMkBKt7AmJgWpagGye+7mqmmuGjj2l1cxGNOxnplTuf6De6ih8epQujBK fIFuHfPhzd8F/q8TYCyrStg8dq0vaTJSnkDsxn0fLi5wquEXTK9zwRY7FUtO6QRpXmh2 6iX+UQyAK4DytiaCqLFZ8Adj+KpeGFBaSP1qpJTGCd9p5X7p5Eif1CwipWYLHqdSLKAO +rPEahafW6FjnvvNJPMYU8ZqYfciurHJ4kJdx6d+IqV5CaFo37PO3O/GT37OfPUaQOXr HF+SfGtRtGQLOtJX5W1RhtwTdmps6YS6v/BDYgCRcmprV09XHrjhc/j4vjznFh7GeptS tOEA== 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=yMEZT+4ZueM2FZOuf8dldalBV3D6dGyvVOjrtQyx4hM=; b=vDfrFhRegrjaR9ZKPHZOuG7OcaUbSeRSGGhuPeF/oqlnfEOV79rV9x0V3xX7/kHfk7 +5gleM5jI2X4+Nr8NeaCzPLclQu0aQVoqUAItm3KTHD16fv7d45Mw0CxNipQtzFQJzkn CBn2P6gK6atGSCPX9Bgm0D8UYypl04xJCa6vADrVqz92BP5iuDafZT95+rR9dn1gvYxy H70KzsY1bSCdxgoMdSIiEBENY4yAkCfgx6zNO79SZQAWtm3sfI3FcdPSSuJ2VcQTOcwZ d8wZzgSI4bx1AzeVIi5hb91YPmlpOmAUqJfwOCId50aJPt0tBX3DAHTcBrU/uvTgrHi4 cEVg== X-Gm-Message-State: ACrzQf03+BfvCqQwfCoCYbTY5wCGOx5JJejH+VjDsHlw3rY48xPhVPAz xCTOPWEeIzV0kAyhEbz9cuTzuQ+Pjy4Owm2IYmU= X-Google-Smtp-Source: AMsMyM56VQJg7UzJzlTbaYGJI9RBflYeHe0CJ2hU1GrHk+oj5L+d9oWNRWmX1Zw2Xzn0AGvqHOSjoOIBOdnrrSYc0oc= X-Received: by 2002:ac8:5f09:0:b0:35c:bf70:6a63 with SMTP id x9-20020ac85f09000000b0035cbf706a63mr1197334qta.500.1665005296075; Wed, 05 Oct 2022 14:28:16 -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 14:27:39 -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=-3018.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 1:43 PM Adhemerval Zanella Netto wrote: > > > > On 05/10/22 15:06, H.J. Lu wrote: > > 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. > > It might be an option to a subsequent patch, but I would avoid trying to outsmart > the compiler here since it might generate a smaller in other version and it would > most likely be arch-specific (adding even more building complexity). > Fair enough. LGTM. Thanks. -- H.J.