From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id B11923858401 for ; Tue, 9 Aug 2022 21:52:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B11923858401 Received: by mail-qk1-x736.google.com with SMTP id f14so9862399qkm.0 for ; Tue, 09 Aug 2022 14:52:02 -0700 (PDT) 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; bh=yiG7TvhNe5DNvjzype84L8svVfz64cRL/BrrOHwlhPo=; b=EScEyPek3fMYvlX8yOvofEs3boID+Xk3ug3yPU7eiPUQPZJ801ALCgifJyCCYd4h+m W0PSRAuho39DCdO4svH2XjdCYSPLFKLyLbwsr/D394MEKrXmoEOrnYT81ira2T2WXWat bN/veGMCWeeV/LBlbPQqXjF5EKdnnmvFZy/aCZ6K6APsynwKB+3kjlQ2sZrsJ44adoea qVCMQcEWBfnUXUqALRlhXJLTaqW9lkpXsmx9BIPOfAid2jidtl18mEuxzfisVXOVKzvc KkqxaLu0TZuKcXAK8PWSesZOdzpe03n8akvC5pE9JU5ZRy+Tps14/HV0ZnVrUFMu5zxS wlTA== X-Gm-Message-State: ACgBeo346N+faLzRPQ9yFSYaRuPOB3XrHNII7wgOtvb+LeSgY7ZaWeih 4qVhGu3gxB6GpsnR5a2UkaE48qVo0BJBjcz3SC6XJulyO2Y= X-Google-Smtp-Source: AA6agR6iPsfVyaSx4LIhM+Y1+FfsaKGYqOE0YkK3Lt6WxovTkyEwclckfN+WjZ/T/WPs2dxraCZnoSQk+MuXMxZG3X8= X-Received: by 2002:a05:620a:254d:b0:6ab:84b8:25eb with SMTP id s13-20020a05620a254d00b006ab84b825ebmr18998584qko.383.1660081921954; Tue, 09 Aug 2022 14:52:01 -0700 (PDT) MIME-Version: 1.0 References: <20220808200021.763123-1-adhemerval.zanella@linaro.org> <8edb1934-df86-6956-b90c-16032ff67df9@linaro.org> <9e01cc4b-7acd-5719-6615-8fb3cb6bf80b@linaro.org> In-Reply-To: From: "H.J. Lu" Date: Tue, 9 Aug 2022 14:51:26 -0700 Message-ID: Subject: Re: [PATCH] elf: Remove -fno-tree-loop-distribute-patterns usage on dl-support To: Adhemerval Zanella Netto Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3017.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Aug 2022 21:52:05 -0000 On Tue, Aug 9, 2022 at 12:40 PM Adhemerval Zanella Netto wrote: > > > > On 09/08/22 16:34, H.J. Lu wrote: > > On Tue, Aug 9, 2022 at 12:32 PM Adhemerval Zanella Netto > > wrote: > >> > >> > >> > >> On 09/08/22 16:06, H.J. Lu wrote: > >>> On Tue, Aug 9, 2022 at 11:48 AM Adhemerval Zanella Netto > >>> wrote: > >>>> > >>>> > >>>> > >>>> On 09/08/22 15:31, H.J. Lu wrote: > >>>>> On Tue, Aug 9, 2022 at 5:11 AM Adhemerval Zanella Netto > >>>>> wrote: > >>>>>> > >>>>>> > >>>>>> > >>>>>> On 08/08/22 19:16, H.J. Lu wrote: > >>>>>> > >>>>>>>> --- a/sysdeps/x86_64/multiarch/memset-evex-unaligned-erms.S > >>>>>>>> +++ b/sysdeps/x86_64/multiarch/memset-evex-unaligned-erms.S > >>>>>>>> @@ -44,4 +44,7 @@ > >>>>>>>> > >>>>>>>> # define USE_LESS_VEC_MASK_STORE 1 > >>>>>>>> # include "memset-vec-unaligned-erms.S" > >>>>>>>> +# if !defined NO_MULTIARCH && MINIMUM_X86_ISA_LEVEL >= 4 > >>>>>>>> +strong_alias (__memset_evex_unaligned, __memset_generic) > >>>>>>>> +# endif > >>>>>>>> #endif > >>>>>>> > >>>>>>> This will define 2 __memset_generic for -march=x86-64-v4. > >>>>>> > >>>>>> Are you sure? Check with a x86_64 build with -march=x86-64-v4 I am seeing: > >>>>>> > >>>>>> $ readelf -Ws string/memset*.os | grep -w __memset_generic | wc -l > >>>>>> 1 > >>>>>> > >>>>>> And it is indeed provided only by string/memset-evex-unaligned-erms.os. > >>>>> > >>>>> You are right. Since dl-symbol-hacks.h defines memset to an alias, > >>>>> should it be moved to sysdes/generic and each arch can provide a > >>>>> suitable alias? > >>>> > >>>> The dl-symbol-hacks.h is meant to be used solely by loader code (that's > >>>> why I have added to elf/), but I don't have a strong preference. > >>> > >>> The default should be no alias. Only IFUNC targets need to define a > >>> proper alias. > >> > >> Alright, although I added the alias on all targets to avoid adding another > >> hook to specify whether memset is implemented by IFUNC (to enable the > >> symbol redirection instead of use the default symbol name). I am not sure > >> if making arch-specific will simplify the required code here. > > > > But your patch adds alias to all targets. > > Yes, because otherwise we will need something like HAVE_MEMSET_IFUNC to add: > > #if defined SHARED && HAVE_MEMSET_IFUNC > asm ("memset = __memset_generic"); > #endif > > I don't have a strong preference, although it is another this will require > to have kernel-features.h (which we usually add the HAVE_*) on elf objects. There are elf/Makefile:CFLAGS-dl-tunables.c += -fno-tree-loop-distribute-patterns elf/Makefile:CFLAGS-rtld.c += -fno-tree-loop-distribute-patterns elf/Makefile:CFLAGS-dl-support.c = -fno-tree-loop-distribute-patterns include/libc-symbols.h: __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) string/test-string.h: __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns"))) There should be no check on SHARED. It can be something like #define SYMBOL_STR1(s) #s #define SYMBOL_STR(s) SYMBOL_STR1(s) #ifdef DEFAULT_MEMSET asm ("memset = " _SYMBOL_STR (DEFAULT_MEMSET)); #endif -- H.J.