Dummy pthread functions in libc considered harmful

Samuel Thibault samuel.thibault@ens-lyon.org
Tue Aug 25 07:36:00 GMT 2015


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



More information about the Libc-alpha mailing list