public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Broken MIPS build
@ 2015-05-21 20:09 Steve Ellcey
  2015-05-21 21:03 ` Joseph Myers
  2015-05-22 18:00 ` Roland McGrath
  0 siblings, 2 replies; 4+ messages in thread
From: Steve Ellcey @ 2015-05-21 20:09 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU C Library

Roland,

This patch:

2015-05-20  Roland McGrath  <roland@hack.frob.com>

	* sysdeps/nacl/pthread-pids.h: New file.
	* sysdeps/nacl/createthread.c: Include <pthread-pids.h>.
	(create_thread): Use __nacl_get_tid to initialize PD->tid.

	* nptl/pthread-pids.h: New file.
	* sysdeps/unix/sysv/linux/pthread-pids.h: New file.
	* nptl/nptl-init.c: Include <pthread-pids.h>.
	(__pthread_initialize_minimal_internal):
	Call __pthread_initialize_pids instead of set_tid_address syscall.

	* sysdeps/unix/sysv/linux/usleep.c: Moved to ...
	* sysdeps/posix/usleep.c: ... here.


Has broken the MIPS glibc build.  The error message is attached below.  I
am guessing I might need to include one (or both) of your new header files
in mips/mips32/sysdep.h to make this build?  Does that sound right to you?


In file included from ../sysdeps/mips/nptl/tls.h:66:0,
                 from ../include/errno.h:27,
                 from nptl-init.c:20:
nptl-init.c: In function '__pthread_initialize_minimal_internal':
nptl-init.c:333:48: error: 'err' undeclared (first use in this function)
   int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
                                                ^
../sysdeps/unix/sysv/linux/mips/mips32/sysdep.h:204:2: note: in definition of macro 'internal_syscall2'
  err = __a3;       \
  ^
nptl-init.c:333:13: note: in expansion of macro 'INTERNAL_SYSCALL'
   int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
             ^
nptl-init.c:333:48: note: each undeclared identifier is reported only once for each function it appears in
   int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
                                                ^
../sysdeps/unix/sysv/linux/mips/mips32/sysdep.h:204:2: note: in definition of macro 'internal_syscall2'
  err = __a3;       \
  ^
nptl-init.c:333:13: note: in expansion of macro 'INTERNAL_SYSCALL'
   int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
             ^
make[2]: *** [/scratch/sellcey/repos/glibc-build2/obj-mips-mti-linux-gnu/glibc/obj_default/nptl/nptl-init.o] Error 1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Broken MIPS build
  2015-05-21 20:09 Broken MIPS build Steve Ellcey
@ 2015-05-21 21:03 ` Joseph Myers
  2015-05-22 18:00 ` Roland McGrath
  1 sibling, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2015-05-21 21:03 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: Roland McGrath, GNU C Library

On Thu, 21 May 2015, Steve Ellcey wrote:

> Has broken the MIPS glibc build.  The error message is attached below.  I
> am guessing I might need to include one (or both) of your new header files
> in mips/mips32/sysdep.h to make this build?  Does that sound right to you?

It seems to me like there's a missing INTERNAL_SYSCALL_DECL (err); in 
__pthread_initialize_minimal_internal.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Broken MIPS build
  2015-05-21 20:09 Broken MIPS build Steve Ellcey
  2015-05-21 21:03 ` Joseph Myers
@ 2015-05-22 18:00 ` Roland McGrath
  2015-05-22 18:08   ` Steve Ellcey
  1 sibling, 1 reply; 4+ messages in thread
From: Roland McGrath @ 2015-05-22 18:00 UTC (permalink / raw)
  To: sellcey; +Cc: GNU C Library

Fixed thusly.  I'm not set up to compile for any machine where
INTERNAL_SYSCALL_DECL is not a no-op, so I've only build-tested
this on x86_64.  But it should cover all cases correctly and be
much less prone to reintroducing such a bug in the future.


Thanks,
Roland


2015-05-22  Roland McGrath  <roland@hack.frob.com>

	* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
	Use a separate INTERNAL_SYSCALL_DECL (err); in a local scope
	for each INTERNAL_SYSCALL use.

diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 5b8d931..8a51161 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -322,19 +322,22 @@ __pthread_initialize_minimal_internal (void)
 #endif
 
   /* Initialize the robust mutex data.  */
+  {
 #ifdef __PTHREAD_MUTEX_HAVE_PREV
-  pd->robust_prev = &pd->robust_head;
+    pd->robust_prev = &pd->robust_head;
 #endif
-  pd->robust_head.list = &pd->robust_head;
+    pd->robust_head.list = &pd->robust_head;
 #ifdef __NR_set_robust_list
-  pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
-				  - offsetof (pthread_mutex_t,
-					      __data.__list.__next));
-  int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
-			      sizeof (struct robust_list_head));
-  if (INTERNAL_SYSCALL_ERROR_P (res, err))
+    pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
+				    - offsetof (pthread_mutex_t,
+						__data.__list.__next));
+    INTERNAL_SYSCALL_DECL (err);
+    int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
+				sizeof (struct robust_list_head));
+    if (INTERNAL_SYSCALL_ERROR_P (res, err))
 #endif
-    set_robust_list_not_avail ();
+      set_robust_list_not_avail ();
+  }
 
 #ifdef __NR_futex
 # ifndef __ASSUME_PRIVATE_FUTEX
@@ -342,6 +345,7 @@ __pthread_initialize_minimal_internal (void)
      doing the test once this early is beneficial.  */
   {
     int word = 0;
+    INTERNAL_SYSCALL_DECL (err);
     word = INTERNAL_SYSCALL (futex, err, 3, &word,
 			    FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
     if (!INTERNAL_SYSCALL_ERROR_P (word, err))
@@ -362,6 +366,7 @@ __pthread_initialize_minimal_internal (void)
 	 is irrelevant.  Given that passing six parameters is difficult
 	 on some architectures we just pass whatever random value the
 	 calling convention calls for to the kernel.  It causes no harm.  */
+      INTERNAL_SYSCALL_DECL (err);
       word = INTERNAL_SYSCALL (futex, err, 5, &word,
 			       FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME
 			       | FUTEX_PRIVATE_FLAG, 1, NULL, 0);
@@ -414,8 +419,11 @@ __pthread_initialize_minimal_internal (void)
 # ifdef SIGSETXID
   __sigaddset (&sa.sa_mask, SIGSETXID);
 # endif
-  (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
-			   NULL, _NSIG / 8);
+  {
+    INTERNAL_SYSCALL_DECL (err);
+    (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &sa.sa_mask,
+			     NULL, _NSIG / 8);
+  }
 #endif
 
   /* Get the size of the static and alignment requirements for the TLS

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Broken MIPS build
  2015-05-22 18:00 ` Roland McGrath
@ 2015-05-22 18:08   ` Steve Ellcey
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Ellcey @ 2015-05-22 18:08 UTC (permalink / raw)
  To: Roland McGrath; +Cc: GNU C Library

On Fri, 2015-05-22 at 10:21 -0700, Roland McGrath wrote:
> Fixed thusly.  I'm not set up to compile for any machine where
> INTERNAL_SYSCALL_DECL is not a no-op, so I've only build-tested
> this on x86_64.  But it should cover all cases correctly and be
> much less prone to reintroducing such a bug in the future.
> 
> 
> Thanks,
> Roland

Thanks Roland,

That fixed the build problem I was having on MIPS.

Steve Ellcey
sellcey@imgtec.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-22 17:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-21 20:09 Broken MIPS build Steve Ellcey
2015-05-21 21:03 ` Joseph Myers
2015-05-22 18:00 ` Roland McGrath
2015-05-22 18:08   ` Steve Ellcey

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).