This is an archive of the discontinued LLVM Phabricator instance.

Rename tsan_interceptors.cpp into tsan_interceptors_posix.cpp
ClosedPublic

Authored by vitalybuka on Sep 27 2019, 7:19 PM.

Details

Summary

It's needed to use __GLIBC_PREREQ from <features.h>

tsan didn't let us to include <features.h> by using --sysroot=. to disable system includes on
anything that is not named as "tsan*posix*", "tsan*mac*", "tsan*linux*".
See compiler-rt/lib/tsan/CMakeLists.txt

Diff Detail

Repository
rL LLVM

Event Timeline

vitalybuka created this revision.Sep 27 2019, 7:19 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 27 2019, 7:19 PM
Herald added subscribers: llvm-commits, Restricted Project, mgorny. · View Herald Transcript

This is to prevent accidental inclusion of system headers:

Make sure that non-platform-specific files don't include any system headers.

The original decision was that sanitizer runtimes must not include any:
https://github.com/dvyukov/data-race-test-1/commit/259f05f44
Kostya was the main proponent of this.

That part is clear from the message. However do we know particular cases which it breaks? If not I propose to make all sanitizers consistent. We do that for either all or none.

Now if I need to reorder includes in sanitizer_common, I had to hack around this check.

It should break any attempts to include any system headers like <stdio.h>, <sys/types.h> etc.

It should break any attempts to include any system headers like <stdio.h>, <sys/types.h> etc.

What the patch is going to break? Should I find another solution? But it's going to be ugly, with splitting and moving tsan_interceptors.cpp
files into rtl/tsan*posix* rtl/tsan*mac* as it needs <features.h> to define __sanitizer_sigaction

It won't break anything. It's like removing -Wall flag.

vitalybuka planned changes to this revision.Sep 30 2019, 3:15 PM
vitalybuka retitled this revision from tsan: Remove --sysroot=. from tsan to Rename tsan_interceptors.cpp into tsan_interceptors_posix.cpp.Sep 30 2019, 4:08 PM
vitalybuka edited the summary of this revision. (Show Details)
kcc accepted this revision.Sep 30 2019, 4:11 PM

but please update the commit message to explain why this enables us to use __GLIBC_PREREQ

This revision is now accepted and ready to land.Sep 30 2019, 4:11 PM
vitalybuka edited the summary of this revision. (Show Details)Sep 30 2019, 4:14 PM
This revision was automatically updated to reflect the committed changes.
compiler-rt/trunk/lib/tsan/CMakeLists.txt