This commit enables the pthread library to hook into the libc execution model and can be reverted after #2812 is fixed. Issue #2791