I'm not very proud of this solution, but unless anyone has a better ideas this is how I plan to add the atomic operations for shared_ptr. I used __gnu_cxx::__mutex instead of std::mutex because it has fewer dependencies, so the atomic operations should always be available for shared_ptr even when the target doesn't support C++11 threads. The operations are also defined for the __shared_ptr class template. Tested x86_64-linux.