[PATCH] D60285: Make calls into the pthread library use weak symbols.

Louis Dionne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 11:46:15 PDT 2019


ldionne added inline comments.


================
Comment at: libunwind/src/RWMutex.hpp:62
+extern "C" int __attribute__((weak))
+pthread_create(pthread_t *thread, const pthread_attr_t *attr,
+               void *(*start_routine)(void *), void *arg);
----------------
When you redeclare functions like this, are attributes stacked with the attributes of other (previous) declarations?


================
Comment at: libunwind/src/RWMutex.hpp:73
+// functions themselves, because the data structure should only be locked if
+// another thread has been created. This is what similar libraries do.
+
----------------
Just to make sure I understand: `pthread_create != nullptr` is only going to be satisfied if `pthread_create` was linked into the program, _and_ it was used at least once before? I thought it would be non-null whenever it was linked into the program, whether you used it or not.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60285/new/

https://reviews.llvm.org/D60285





More information about the llvm-commits mailing list