Message ID | 20221028173532.876027-12-adhemerval.zanella@linaro.org |
---|---|
State | Committed |
Commit | 3d8b5dde879c6e024548118914da5bfcbd5170a7 |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3357F3861020 for <patchwork@sourceware.org>; Fri, 28 Oct 2022 17:39:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3357F3861020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666978786; bh=aEqZsFnmWtQ8+HtQ8PHr3LfGGki/Jn/+C55yVPH24AA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=W7XgOFleYaWM9dSJ6K0a+K6ktGiVmMgVpRD/HKR2chxnPsrbJBTqC+zvLU9MHj01Y youK2SXD8A1ijo9Al3/9QO724xdSlWkXahxIsSdplDHs4ejPhUZ1Ok283VK3wF6ith jMpuyT0qJDVm70fzWmTXnjQ+UzuOaXDX61daXwv4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id E3A2F385803D for <libc-alpha@sourceware.org>; Fri, 28 Oct 2022 17:35:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E3A2F385803D Received: by mail-ot1-x32c.google.com with SMTP id a13-20020a9d6e8d000000b00668d65fc44fso3345612otr.9 for <libc-alpha@sourceware.org>; Fri, 28 Oct 2022 10:35:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aEqZsFnmWtQ8+HtQ8PHr3LfGGki/Jn/+C55yVPH24AA=; b=ikxtHpyFi/qW7q9m0q8AfmpLL7x6MyJK2l+e2zWq/LcNd/+lf2tEO2ccrVkkddWhig thGoCpFLoruHAH5DsOWDIdzPh2kTetvwa0F/U5raFaWNNXK+vaQXuFiWBMTuOq5eatpL oPnRs1dj0KFjxxYhGmzdRXMrR+6n6yMdBqoTd7mRWPj1bxl2p24iE2fh3mYOyMS7nQ3C R7dJC+0rppD8h56ICHxCO4Dg2rVJEvW82RzrRx614EjTz5mYkFNSZy1OmGoTPZiMP9Bw giKMUjkpsQcVIY3HnSSVB6h2E+qqvWCQCVaTukuf1SzMSosC74qbJrEApybABFMd3tve faQg== X-Gm-Message-State: ACrzQf0KUT/K0pXWKE4e4IJZSAsteipMFj9Zy0Ks7aCmcE6zBcRUzHNL 5+kasOCOCBwRBMoA7XHiW5Bsu9pAvWb/MB3T X-Google-Smtp-Source: AMsMyM7hnWCxO5F785nijzqBcGGJy7tMPabR8JsjO/tIfascq9wMx0667LiOCZbTelVMWV+G7BNGcA== X-Received: by 2002:a9d:2909:0:b0:661:9cae:6f08 with SMTP id d9-20020a9d2909000000b006619cae6f08mr226376otb.277.1666978554247; Fri, 28 Oct 2022 10:35:54 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:17c8:6484:1100:1451:7f3f]) by smtp.gmail.com with ESMTPSA id v10-20020a056870b50a00b0012779ba00fesm2434998oap.2.2022.10.28.10.35.53 for <libc-alpha@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 10:35:54 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 11/11] nptl: Fix pthread_create.c build with clang Date: Fri, 28 Oct 2022 14:35:32 -0300 Message-Id: <20221028173532.876027-12-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028173532.876027-1-adhemerval.zanella@linaro.org> References: <20221028173532.876027-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Adhemerval Zanella <adhemerval.zanella@linaro.org> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Initial fixes for clang build support
|
|
Checks
Context | Check | Description |
---|---|---|
dj/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
dj/TryBot-32bit | success | Build for i686 |
Commit Message
Adhemerval Zanella
Oct. 28, 2022, 5:35 p.m. UTC
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. --- nptl/pthread_create.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Comments
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 <maskray@google.com> >--- > 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 >
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 <maskray@google.com> 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 >>
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