]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
nptl: Fix pthread_create.c build with clang
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 25 Oct 2022 14:07:59 +0000 (11:07 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 1 Nov 2022 12:51:10 +0000 (09:51 -0300)
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>
nptl/pthread_create.c

index 32ae2f4b2fcb81d057c6cea68182af20f8a4e1f9..34a41a0fdf460f57546a63506489b6a782799fc0 100644 (file)
 
 
 /* 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