public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] nptl: Fix pthread_create.c build with clang
@ 2022-11-01 13:09 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-11-01 13:09 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3d8b5dde879c6e024548118914da5bfcbd5170a7

commit 3d8b5dde879c6e024548118914da5bfcbd5170a7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Oct 25 11:07:59 2022 -0300

    nptl: Fix pthread_create.c build with clang
    
    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.
    
    Reviewed-by: Fangrui Song <maskray@google.com>

Diff:
---
 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-01 13:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01 13:09 [glibc] nptl: Fix pthread_create.c build with clang Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).