This is an archive of the discontinued LLVM Phabricator instance.

[gn build] add build file for tsan runtime
ClosedPublic

Authored by thakis on Apr 2 2021, 8:17 AM.

Details

Summary

Linux-only for now. Some mac bits stubbed out, but not tested.

Good enough for the tiny_race.c example at
https://clang.llvm.org/docs/ThreadSanitizer.html :

$ out/gn/bin/clang -fsanitize=address -g -O1 tiny_race.c
$ while true; do ./a.out || echo $? ; done

While here, also make -fsanitize=address work for .c files.

Diff Detail

Event Timeline

thakis created this revision.Apr 2 2021, 8:17 AM
thakis requested review of this revision.Apr 2 2021, 8:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2021, 8:17 AM
thakis updated this revision to Diff 334965.Apr 2 2021, 8:43 AM

add fPIE. no idea if it matters, the the cmakelist.txt file claims it does.

aeubanks accepted this revision.Apr 2 2021, 9:41 AM
aeubanks added inline comments.
llvm/utils/gn/secondary/compiler-rt/lib/tsan/BUILD.gn
153–156

is the lsan stuff needed?

This revision is now accepted and ready to land.Apr 2 2021, 9:41 AM
thakis added inline comments.Apr 2 2021, 9:57 AM
llvm/utils/gn/secondary/compiler-rt/lib/tsan/BUILD.gn
153–156

oh good catch, it's not. thanks!

This revision was landed with ongoing or failed builds.Apr 2 2021, 9:59 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2021, 9:59 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript