[PATCH] D25897: Add __no_instrument_function__ to _LIBCPP_INLINE_VISIBILITY and _LIBCPP_ALWAYS_INLINE

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 4 19:03:23 PDT 2016

EricWF added a comment.

> 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.

That isn't quite correct. This problem only occurs on methods which are externally instantiated withing the dylib but there definitions are marked `__attribute__((visibility("hidden")))`.
For example `std::string` and `std::num_get`. Therefore the compiler *knows* there is an externally available definition but its hidden from the linker.

I would prefer to fix this by using `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` on these methods instead of `_LIBCPP_INLINE_VISIBILITY` or `_LIBCPP_ALWAYS_INLINE` instead.


More information about the cfe-commits mailing list