This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Dummy pthread functions in libc considered harmful
- From: Samuel Thibault <samuel dot thibault at ens-lyon dot org>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, Rich Felker <dalias at libc dot org>, libc-alpha at sourceware dot org
- Date: Tue, 25 Aug 2015 09:36:30 +0200
- Subject: Re: Dummy pthread functions in libc considered harmful
- Authentication-results: sourceware.org; auth=none
- References: <mvmr3ms4sbj dot fsf at hawking dot suse dot de> <20150824153816 dot GC3210 at type dot bordeaux dot inria dot fr> <20150824162250 dot GD32742 at brightrain dot aerifal dot cx> <20150824162641 dot GH3210 at type dot bordeaux dot inria dot fr> <mvmbndv4zeh dot fsf at hawking dot suse dot de> <55DC1700 dot 6060905 at redhat dot com>
Florian Weimer, le Tue 25 Aug 2015 09:19:28 +0200, a écrit :
> (Note: I do not fully understand the sysdeps overrides, someone more
> familiar with the code should check that the fast path is currently
> missing from the libpthread version.)
That can be seen in e.g. sysdeps/unix/sysv/linux/x86_64/lowlevellock.h:
#if !IS_IN (libc) || defined UP
# define __lll_lock_asm_start LOCK_INSTR "cmpxchgl %4, %2\n\t" \
"jz 24f\n\t"
#else
# define __lll_lock_asm_start "cmpl $0, __libc_multiple_threads(%%rip)\n\t" \
"je 0f\n\t" \
"lock; cmpxchgl %4, %2\n\t" \
"jnz 1f\n\t" \
"jmp 24f\n" \
"0:\tcmpxchgl %4, %2\n\t" \
"jz 24f\n\t"
#endif
So code compiled in libpthread always has the lock prefix (and in the UP
case LOCK_INSTR is empty)
Samuel