From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by sourceware.org (Postfix) with ESMTPS id 55C553857696 for ; Mon, 31 Oct 2022 20:12:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 55C553857696 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-pj1-x102a.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so16914506pjc.3 for ; Mon, 31 Oct 2022 13:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=4KMHUm9HfVbO5VTTBWIDbcoZb0a9qUtYa6vKRtFZCuo=; b=dJue/TAwxggsKgaxvhWo6COOClNJk8AniPlR8ttiZm7fssoRwOge3EvkX7KWKqrIZK r2uSyiwaPOBN1wv9WQdPVfzpXiUCLnwmOs4eYXu4bMduBIZ20ZKofY/M6PkSARfgL9KK TTCz6WuSmSY+3FmQkRiIEcZSnOtM51MMCKXO8bRujT+/gimvNHDJzGvuOx/jBFjrOikd s2PtUyKc+72Y7lg2jjehQzNyFWyNjg1UdNwDRObyK7O4oRjLDevIFUaRzMDNnJjJUfoA A17YCr6Pbtx1VuuRS9AojbWY9Q+SGMw0mFqWsHYzc8Hp/iEC2zSemsZ9xvKIGksuVaIC DifA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4KMHUm9HfVbO5VTTBWIDbcoZb0a9qUtYa6vKRtFZCuo=; b=geTagvkk3gjCi2v3LfO3hKFeJVYGNyFjRB9X/v2vKGOepPkXnlMZL1Yg8yApm5ZejQ zDvVjcrP2u85dw2B9iwCgkhZa4voO+BlvHJdiCmM+Qh5MlbDrnRVeHjUNtFYcvoZIF+A J6nGuzBk3U9m107aPSNdfznNB0cjYG2sLF5hUSATWFex4WQbnPxlC2eeMuhU4e4+CcaV zIIhx9fHkW/irBuAgKhSIefOwksJrXzkkpL+kHSLhue6i9HOPxZ85VNig8nRO9GpL8EI VMwHlu7tzgnhP/inE6aGSTQhzs0CgrCmin+nZBIW+mu+cR1QiXD8rTu3oEjprfQ/FTtI 5oQg== X-Gm-Message-State: ACrzQf3gTlux9Usry0aLr6ySnUS4CzFG9wwW7KXzl8oB1b3C1mGFH9zD H6nDUGlJ0JJBfKK5Z6wDJfuOyQ3PiY4t5w== X-Google-Smtp-Source: AMsMyM4qfdmfTAgn+LJ4BH3TRZYKx0JGQZ9aSJwywBRjuI48qNeVCwKZtqG/76mHl+u0fLTDpp4rNw== X-Received: by 2002:a17:90a:fa46:b0:20d:5efa:84fc with SMTP id dt6-20020a17090afa4600b0020d5efa84fcmr33035894pjb.20.1667247122237; Mon, 31 Oct 2022 13:12:02 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:3c48:8136:92ed:9cbd]) by smtp.gmail.com with ESMTPSA id y7-20020aa78f27000000b0056bb36c047asm4996927pfr.105.2022.10.31.13.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Oct 2022 13:12:01 -0700 (PDT) Date: Mon, 31 Oct 2022 13:11:58 -0700 From: Fangrui Song To: Adhemerval Zanella Netto Cc: libc-alpha@sourceware.org Subject: Re: [PATCH 08/11] configure: Use -Wno-ignored-attributes if compiler warns about multiple aliases Message-ID: <20221031201158.dhurlc6zo3hzg3wl@google.com> References: <20221028173532.876027-1-adhemerval.zanella@linaro.org> <20221028173532.876027-9-adhemerval.zanella@linaro.org> <20221029055936.y4qtf52hxnqba2en@google.com> <7d316b23-8d02-5158-5f07-ac4083e41160@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7d316b23-8d02-5158-5f07-ac4083e41160@linaro.org> X-Spam-Status: No, score=-20.3 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 2022-10-31, Adhemerval Zanella Netto wrote: > > >On 29/10/22 02:59, Fangrui Song wrote: >> On 2022-10-28, Adhemerval Zanella via Libc-alpha wrote: >>> clang emits an warning when a double alias redirection is used, to warn >>> the the original symbol will be used even when weak definition is >>> overridden.  Howerver, this is a common pattern for weak_alias, where >>> multiple alias are set to same symbol. >> >> Confirmed that the pattern is common.  >> % rg -U 'libc_hidden_def.*\nweak_alias.*\nlibc_hidden_weak' -l >> login/getlogin_r.c >> libio/iofgets_u.c >> libio/iofflush.c >> libio/iofputs_u.c >> libio/iofflush_u.c >> libio/iofgets.c >> libio/fileno.c >> string/memmem.c >> resource/getrlimit64.c >> string/argz-next.c >> inet/if_index.c >> io/open.c >> string/basename.c >> wcsmbs/wmemset.c >> wcsmbs/wcschr.c >> wcsmbs/wmemchr.c >> wctype/wcfuncs.c >> resolv/inet_pton.c >> sysdeps/x86_64/wmemchr.S >> sysdeps/x86_64/memset.S >> sysdeps/unix/getlogin_r.c >> sysdeps/x86_64/wcschr.S >> sysdeps/mach/hurd/getpid.c >> sysdeps/mach/hurd/read.c >> sysdeps/mach/hurd/write.c >> sysdeps/mach/hurd/getlogin_r.c >> sysdeps/mach/hurd/if_index.c >> sysdeps/mach/hurd/fcntl.c >> sysdeps/mach/hurd/open.c >> sysdeps/unix/sysv/linux/getlogin_r.c >> sysdeps/unix/sysv/linux/fcntl64.c >> sysdeps/unix/sysv/linux/if_index.c >> >> The three macros can be reordered and there may be more results. > >Yes, I added as per need for the ABIs I am working now (aarch64, x86_64, i686, >and armhf). It would most likely need to add such warning suppression when/if >more architecture are enabled. > >> >> I just took some notes here https://maskray.me/blog/2021-10-10-when-can-glibc-be-built-with-clang#alias-to-a-weak-alias >> I feel that the pattern is ugly but I cannot figure out a better way. Clang has a reasonable diagnostic. It is fine to ignore it as the Clang symbol codegen matches GCC. >> >> ``` >> 26: 0000000000000000   596 FUNC    GLOBAL HIDDEN     1 __GI___mbrtowc >> 33: 0000000000000000   596 FUNC    GLOBAL DEFAULT    1 __mbrtowc >> 34: 0000000000000000   596 FUNC    WEAK   HIDDEN     1 __GI_mbrtowc >> 35: 0000000000000000   596 FUNC    WEAK   DEFAULT    1 mbrtowc >> ``` >> >> So here is a Reviewed-by tag: but I really hope that we can come up with a better way. > >I am open to how to better solve as well, I might revise it in the future. I think there is likely room for improvement but that can be very tricky (need to think how to reorganize the attributes and need to refactor at least the above files). -Wno-ignored-attributes is a decent solution for now, so I provided a Reviewed-by: :) >> >> Reviewed-by: Fangrui Song > >Thanks.