This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PowerPC] private futex build error


On Tue, Jul 8, 2008 at 8:29 PM, Hiroki Kaminaga <kaminaga@sm.sony.co.jp>
wrote:
> Thanks!
> would appreciate your time.

Hiroki,

I don't think your patch is entirely correct but it's not entirely wrong
either.  Take a look at this portion of nptl/sysdeps/descr.h:

/* Thread descriptor data structure.  */
struct pthread
{ 
  union
  {
#if !TLS_DTV_AT_TP
    /* This overlaps the TCB as used for TLS without threads (see
tls.h).  */
    tcbhead_t header;
#else
    struct
    { 
      int multiple_threads;
      int gscope_flag;
# ifndef __ASSUME_PRIVATE_FUTEX
      int private_futex;
# endif
    } header;
#endif
...

On PowerPC TLS_DTV_AT_TP is defined.  On i386 in contrast, TLS_TCB_AT_TP
is defined.

So i386 accesses private_futex via the pthread struct's struct tcbhead_t
header private_futex member, e.g.

PRIVATE_FUTEX           offsetof (tcbhead_t, private_futex)

On PowerPC we access private_futex via the pthread struct's struct
header private_futex member, e.g.

# define thread_offsetof(mem)   ((ptrdiff_t) THREAD_SELF + offsetof
(struct pthread, mem))

PRIVATE_FUTEX_OFFSET            thread_offsetof (header.private_futex)

So the part of your patch which adds private_futex to tcbhead_t in
nptl/sysdeps/powerpc/tls.h is not necessary on PowerPC.

The guard in nptl/sysdeps/powerpc/tcb-offsets.sym is necessary.

Carlos Eduardo Seo created the bugzilla entry

I'll add the second half of your patch, with a proper changelog, to the
bugzilla entry, test and then we'll push it to libc-alpha.

2008-04-28  Hiroki Kaminaga  <kaminaga@sm.sony.co.jp>

	[BZ 6740]
	nptl/sysdeps/powerpc/tcb-offsets.sym (PRIVATE_FUTEX_OFFSET):
	Guard sym definition with #ifndef __ASSUME_PRIVATE_FUTEX.

--- a/nptl/sysdeps/powerpc/tcb-offsets.sym
+++ b/nptl/sysdeps/powerpc/tcb-offsets.sym
@@ -15,4 +15,6 @@ MULTIPLE_THREADS_OFFSET               thread_offsetof
 PID                            thread_offsetof (pid)
 TID                            thread_offsetof (tid)
 POINTER_GUARD                  (offsetof (tcbhead_t, pointer_guard) -
TLS_TCB_OFFSET - sizeof (tcbhead_t))
+#ifndef __ASSUME_PRIVATE_FUTEX
 PRIVATE_FUTEX_OFFSET           thread_offsetof (header.private_futex)
+#endif

Regards,

Ryan S. Arnold


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]