When using libc++ along with -finstrument-functions I am seeing link errors, even in the simple hello world case.
It looks like this is caused by functions in libc++'s headers that are marked to always be inlined. Since they are always inlined there is external definition for the linker to get the address of. I have worked around this by adding the no_instrument_function attribute to _LIBCPP_INLINE_VISIBILITY and _LIBCPP_ALWAYS_INLINE.
It looks like this was report with PR17879 but author closed it as invalid. So I could very well be missing something here.
Patch tested by running the test suite with -finstrument-functions set in the compiler flags. Link errors were no longer seen and there was no change to the test result when compared to a clean run. The tests were run using a x86_64 Linux host using gcc 5.4 and clang 3.8 with libc++ from ToT, as well as a QNX Neutrino host using gcc 5.4 and libc++ 3.7.
This may also be a problem on Windows as they has similar attributes being set, but I do not have a setup to test that.