From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by sourceware.org (Postfix) with ESMTPS id 427643857680 for ; Mon, 31 Oct 2022 20:03:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 427643857680 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-x22a.google.com with SMTP id r83so13898484oih.2 for ; Mon, 31 Oct 2022 13:03:22 -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:message-id:reply-to; bh=Z+/x+aII5VCwxT6U1pwvUfXL6dcRuZ2SW58bBiLtxKI=; b=Vco76q3/cGdqwgCk6RGWQl/m1LmovdZEOExEvdUOl5W05zx5Vnxszefm/VkfekHU5o twqBLCcaMT53E4u8qrSnl8B+YqA6sHwBLTNUGd1m0qFe8Vr8WgVwp9WvnpR8zpiTvG4T CBN90yL+sRv7mUhZEvwl6FIMqv4g3MlV1/e/Vq4TF20HVq/BSXUXnNRV2tSklXxTT9eh zshOT22DfVT9NnUph+AxP0sNMj/pULdkzYPaoS/HTDaGsVA9fHU5fxmcOUjcjMb5c/0J 63zAvXH08UT14scAZ38vHkx+EmLY7Dp1eKMHV816yaO5getbPLfiS+PQOQ6GaN1KNtCW RXYw== 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:message-id :reply-to; bh=Z+/x+aII5VCwxT6U1pwvUfXL6dcRuZ2SW58bBiLtxKI=; b=oFZ7dnQuREQo2ySvRCp1Z75AI3iAE5VYn7mn68/sjfX/VVMX1BImfQZA7YQtri/HYU UZ6vXZ0H8gOm6Te81Vxe2TUfCrnwAht/8ixcERuevKpwlR9WyjhotdzV9ztgqYV4wYnV 3K8KOaXl6Nsua987gWt1qyNXJaEfi1rpoW/WiNtOxzoeY6uE8qrTRVxseIE/IKzUzHw8 OZ6RCI335vG6/V2p/oo68KAg9PJjANNwZbAJcmdAew8VbM57/QPnKmH/6GSkY0T+zDdw 56WjNnI21ALaDtFZVocNQYw6p5l8Zn8Giu90Mc/fbYFTjSXh4/dNwaur3mQ779ziprkD pLtg== X-Gm-Message-State: ACrzQf2Fs0Fu1KdQvOB0VQ0TZQKIAJsB6RGWz3wFlGJ1HOejJqpzXCzq P8bk3acI8BlSL/5YS1O5MJbVjjLJ8vdignUa X-Google-Smtp-Source: AMsMyM7dau/+5XmkR0+2EKGsrrCMpl07uGbUGkaT51b65ZTLGWld4E70YL4ON8DtOpVWVRFPozEnWA== X-Received: by 2002:a05:6808:209c:b0:354:7417:911f with SMTP id s28-20020a056808209c00b003547417911fmr7737444oiw.57.1667246601430; Mon, 31 Oct 2022 13:03:21 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c0:17c8:29c8:c66:a795:b2b1? ([2804:1b3:a7c0:17c8:29c8:c66:a795:b2b1]) by smtp.gmail.com with ESMTPSA id cz40-20020a05687064a800b0013bc40b09dasm3484924oab.17.2022.10.31.13.03.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 13:03:21 -0700 (PDT) Message-ID: <995b8708-fcd8-9d60-081f-e37de9be6235@linaro.org> Date: Mon, 31 Oct 2022 17:03:18 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 11/11] nptl: Fix pthread_create.c build with clang Content-Language: en-US To: Fangrui Song Cc: libc-alpha@sourceware.org References: <20221028173532.876027-1-adhemerval.zanella@linaro.org> <20221028173532.876027-12-adhemerval.zanella@linaro.org> <20221029045150.6in65puyr7ev4oop@google.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20221029045150.6in65puyr7ev4oop@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_INFOUSMEBIZ,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 29/10/22 01:51, Fangrui Song wrote: > On 2022-10-28, Adhemerval Zanella via Libc-alpha wrote: >> clang complains that libc_hidden_data_def (__nptl_threads_events) >> creates an invalid alias: >> >>  pthread_create.c:50:1: error: alias must point to a defined variable or function >>  libc_hidden_data_def (__nptl_threads_events) >>  ^ >>  ../include/libc-symbols.h:621:37: note: expanded from macro >>  'libc_hidden_data_def' >> >> It seems that clang requires that a proper prototype is defined prior >> the hidden alias creation. > > I investigated the issue last year: https://maskray.me/blog/2021-10-10-when-can-glibc-be-built-with-clang#aliasing-an-asm-label > > The issue is that when the alias target (__GI___nptl_threads_events) is the asm label name of a declaration, Clang > cannot tell the alias target is actually defined. It conservatively (you may call it wrong) reports an error. > > Reviewed-by: Fangrui Song Thanks. > >> --- >> nptl/pthread_create.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c >> index 32ae2f4b2f..34a41a0fdf 100644 >> --- a/nptl/pthread_create.c >> +++ b/nptl/pthread_create.c >> @@ -45,13 +45,15 @@ >> >> >> /* Globally enabled events.  */ >> -td_thr_events_t __nptl_threads_events; >> +extern td_thr_events_t __nptl_threads_events; >> libc_hidden_proto (__nptl_threads_events) >> +td_thr_events_t __nptl_threads_events; >> libc_hidden_data_def (__nptl_threads_events) >> >> /* Pointer to descriptor with the last event.  */ >> -struct pthread *__nptl_last_event; >> +extern struct pthread *__nptl_last_event; >> libc_hidden_proto (__nptl_last_event) >> +struct pthread *__nptl_last_event; >> libc_hidden_data_def (__nptl_last_event) >> >> #ifdef SHARED >> --  >> 2.34.1 >>