This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Fix weakly imported functions on OS X
ClosedPublic

Authored by kubamracek on Nov 22 2015, 11:37 AM.

Details

Summary

On OS X, for weak function (that user can override by providing their own implementation in the main binary), we need extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE NOINLINE.

Fixes a broken test case on OS X, java_symbolization.cc, which uses a weak function __tsan_symbolize_external.

Diff Detail

Event Timeline

kubamracek retitled this revision from to [tsan] Fix weakly imported functions on OS X.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, kcc, glider, samsonov.
dvyukov accepted this revision.Nov 22 2015, 11:18 PM
dvyukov edited edge metadata.

LGTM with nit

lib/sanitizer_common/sanitizer_internal_defs.h
120–123

also remove CPP_WEAK macro in tsan_defs.h
it was defined to WEAK

This revision is now accepted and ready to land.Nov 22 2015, 11:18 PM
kubamracek updated this revision to Diff 40908.Nov 23 2015, 2:49 AM
kubamracek edited edge metadata.

The previous patch failed several unit tests, because OnReport needs to be exported as a C++ symbol (in __tsan namespace). Changing the patch to have both SANITIZER_WEAK_DEFAULT_IMPL (for C symbols) and SANITIZER_WEAK_CXX_DEFAULT_IMPL (for C++ symbols).

kubamracek requested a review of this revision.Nov 24 2015, 6:11 AM
kubamracek edited edge metadata.
dvyukov accepted this revision.Nov 30 2015, 3:18 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Nov 30 2015, 3:18 AM
This revision was automatically updated to reflect the committed changes.