This is an archive of the discontinued LLVM Phabricator instance.

Handle NetBSD specific indirection of libpthread functions
ClosedPublic

Authored by krytarowski on Nov 20 2017, 3:25 AM.

Details

Summary

Correct handling of three libpthread(3) functions on NetBSD:

  • pthread_mutex_lock(3),
  • pthread_mutex_unlock(3),
  • pthread_setcancelstate(3).

Code out of the libpthread(3) context uses the libc symbols:

  • __libc_mutex_lock,
  • __libc_mutex_unlock,
  • __libc_thr_setcancelstate.

The threading library (libpthread(3)) defines strong aliases:

  • strong_alias(libc_mutex_lock,pthread_mutex_lock)
  • strong_alias(libc_mutex_unlock,pthread_mutex_unlock)
  • strong_alias(libc_thr_setcancelstate,pthread_setcancelstate)

This caused that these functions were invisible to sanitizers on NetBSD.
Intercept the libc-specific ones and add them as NetBSD-specific aliases
for the common pthread(3) ones.

NetBSD needs to intercept both functions, as the regularly named ones
are used internally in libpthread(3).

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Nov 20 2017, 3:25 AM
dvyukov accepted this revision.Nov 20 2017, 3:38 AM
This revision is now accepted and ready to land.Nov 20 2017, 3:38 AM
krytarowski closed this revision.Nov 20 2017, 4:21 AM