From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id C24C93858CDB for ; Wed, 5 Oct 2022 20:43:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C24C93858CDB 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-oi1-x22d.google.com with SMTP id t79so5470854oie.0 for ; Wed, 05 Oct 2022 13:43:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date; bh=iucKg4yJCk1zt9Vc485t6V8Y3QP1R3w9nfbXe5m+P5I=; b=wz3f2fWV3ykJsqbjJgR95trzkAdBddPgEOBXZZK211SyWtElk4bKUlkCkwrFOJb1cR MZgybYxkWO/UAgudSH7N+Yw4E6LTXr2k8e6RosaHn+P1lXAyc3jerEKBi1PDdTgZIch3 2nmXsz9wSJPiBFj03LtTrot1+R0KleyfWD8hxYakiuhZMXKLGKAS0jDV67yMyfVVOLPd wVzRHpvubkytN/PQuO8KKnHBCOkIQyoCcR7ZSbWBbiEwbxObS6FhLILQzdJMGRJ4DJ6e 8LmFBGHdv7fq08If9dAItWUIB5mdsvBb7dL8QgYtGDJ7spGBfGf74dmqW+2cGzfshERe 1uRA== 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:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=iucKg4yJCk1zt9Vc485t6V8Y3QP1R3w9nfbXe5m+P5I=; b=bn+LhTgSXY9cunqkOqU/xmNsWchJJ2o7UqRQldy/hy5DORODnSRV8IZK6vtKuNhhGu XAN4t7iuZ47lA10DFd9ShuqbZIUw7P5a+SdjlXi1a1Jow9zZJAwHEKrfd45tVTxwMylN EjwctY7sar3tls41V1v1nYttApzxZz/hi9WF5KuZD+tAfNyLR1PNp5lKSxKnq/UixAQU pCCe5e8BZ3CcPMBOZMkJNCr1cIaXjoW2YykaRFfMWVh4QD28+YW7L7lP7EkBvJg/G0ix YaOEWYsvnMnZkIHfV3grCo+5FHy9CqT81zpAzKeqcsauAlIT4jGsM/Q32Id62b/x9iyZ P9nw== X-Gm-Message-State: ACrzQf2dDaajG9Ofs4EgFXwn9PMR2vAzWXLa1PIpaat6be0fZfBB4bNM 0thTcBj7kDK5Z+ZN0LO0WiWmzQ== X-Google-Smtp-Source: AMsMyM4FToZVnhN4bCzdIr3nx26UlySWARFFCbS5yJKMOdIoKduV7uKZOyqnjW5QYzpp+c1JVAV0Rg== X-Received: by 2002:a05:6808:3022:b0:350:f71d:13c with SMTP id ay34-20020a056808302200b00350f71d013cmr805413oib.295.1665002608002; Wed, 05 Oct 2022 13:43:28 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c2:b87d:f936:fc03:6bdb:fa59? ([2804:1b3:a7c2:b87d:f936:fc03:6bdb:fa59]) by smtp.gmail.com with ESMTPSA id 38-20020a9d0ba9000000b00636e9a0cce5sm4585733oth.60.2022.10.05.13.43.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Oct 2022 13:43:26 -0700 (PDT) Message-ID: Date: Wed, 5 Oct 2022 17:43:24 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH 6/6] x86: Fix -Os build (BZ #29576) Content-Language: en-US To: "H.J. Lu" Cc: Carlos O'Donell , libc-alpha@sourceware.org References: <20220921135108.3324737-1-adhemerval.zanella@linaro.org> <20220921135108.3324737-7-adhemerval.zanella@linaro.org> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 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).