This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Port tsan_rtl_amd64.S to OS X to add support for setjmp/longjmp
ClosedPublic

Authored by kubamracek on Nov 24 2015, 5:22 AM.

Details

Summary

This patch ports the assembly file tsan_rtl_amd64.S to OS X, where we need several changes:

  • Some assembler directives are not available on OS X (.hidden, .type, .size)
  • Symbol names need to start with an underscore (added a ASM_TSAN_SYMBOL macro for that).
  • To make the interceptors work, we ween to name the function "_wrap_setjmp" (added ASM_TSAN_SYMBOL_INTERCEPTOR for that).
  • Calling the original setjmp is done with a simple "jmp _setjmp".
  • __sigsetjmp doesn't exist on OS X.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 41028.Nov 24 2015, 5:22 AM
kubamracek retitled this revision from to [tsan] Port tsan_rtl_amd64.S to OS X to add support for setjmp/longjmp.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, samsonov, kcc, glider.
dvyukov added inline comments.Nov 26 2015, 8:19 AM
lib/tsan/rtl/tsan_rtl_amd64.S
187 ↗(On Diff #41028)

please do:

#elif defined(__linux__)
...
#else
# error "Unknown platform"

Initially it was just linux, but now it is unclear what does "#else" mean.

226 ↗(On Diff #41028)

same here:

#elif defined(__linux__)
297 ↗(On Diff #41028)

Will it work with pie binaries?.. are there pie binaries on mac?

kubamracek added inline comments.Nov 26 2015, 8:23 AM
lib/tsan/rtl/tsan_rtl_amd64.S
297 ↗(On Diff #41028)

Yes, actually, PIE binaries are the default on OS X (at least for dylibs).

dvyukov accepted this revision.Nov 26 2015, 8:51 AM
dvyukov edited edge metadata.

LGTM if you agree to add #elif defined(linux)

This revision is now accepted and ready to land.Nov 26 2015, 8:51 AM
This revision was automatically updated to reflect the committed changes.