I don't think the interposition is working, or I'm doing something wrong. I changed pthread_mutex_lock.c to the following: $ cat pthread_mutex_lock.c #include #include #define PTHREAD_MUTEX_NO_ELISION_NP 512 extern int __pthread_mutex_lock (pthread_mutex_t *); int pthread_mutex_lock (pthread_mutex_t *mutex) { abort(); mutex->__data.__kind |= PTHREAD_MUTEX_NO_ELISION_NP; return __pthread_mutex_lock (mutex); } $ gcc -c -fPIC pthread_mutex_lock.c $ gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1 I then wrote a small C++ program: $ cat use_foo.cpp #include int main(int argc, char* argv[]) { std::mutex m; std::lock_guard guard(m); return EXIT_SUCCESS; } Compiled it to a.out: $ g++ -std=c++11 -pthread ./use_foo.cpp When run, it does *not* terminate in abort: LD_PRELOAD=$(realpath ./libfoo.so.1 ) ./a.out ; echo $? Under gdb, I can see that the libfoo.so.1 library is loaded: $ LD_PRELOAD=$(realpath ./libfoo.so.1 ) gdb ./a.out GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64le-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./a.out...(no debugging symbols found)...done. (gdb) sta Temporary breakpoint 1 at 0x10000a24 Starting program: /home/acm/opt/src/1640518/a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1". Temporary breakpoint 1, 0x0000000010000a24 in main () (gdb) info inferior Num Description Executable * 1 process 14046 /home/acm/opt/src/1640518/a.out (gdb) !lsof -p 14046 | grep lib a.out 14046 amorrow mem REG 8,2 74328 2621621 /lib/powerpc64le-linux-gnu/libgcc_s.so.1 a.out 14046 amorrow mem REG 8,2 856616 2622143 /lib/powerpc64le-linux-gnu/libm-2.23.so a.out 14046 amorrow mem REG 8,2 1851512 2622139 /lib/powerpc64le-linux-gnu/libc-2.23.so a.out 14046 amorrow mem REG 8,2 171632 2622098 /lib/powerpc64le-linux-gnu/libpthread-2.23.so a.out 14046 amorrow mem REG 8,2 2042040 2752992 /usr/lib/powerpc64le-linux-gnu/libstdc++.so.6.0.21 a.out 14046 amorrow mem REG 8,2 69136 6182484 /home/acm/opt/src/1640518/libfoo.so.1 a.out 14046 amorrow mem REG 8,2 268976 2622140 /lib/powerpc64le-linux-gnu/ld-2.23.so Setting a breakpoint in pthread_mutex_lock lands me in __GI___pthread_mutex_lock. Perhaps the interposition symbol needs to be changed? $ LD_PRELOAD=$(realpath ./libfoo.so.1 ) gdb ./a.out GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "powerpc64le-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./a.out...(no debugging symbols found)...done. (gdb) break pthread_mutex_lock Breakpoint 1 at 0x10000da0 (gdb) r Starting program: /home/acm/opt/src/1640518/a.out [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/powerpc64le-linux-gnu/libthread_db.so.1". Breakpoint 1, __GI___pthread_mutex_lock (mutex=0x3fffb7ff0908 <_rtld_global+2312>) at ../nptl/pthread_mutex_lock.c:67 warning: Source file is more recent than executable.