This is an archive of the discontinued LLVM Phabricator instance.

[Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple.
ClosedPublic

Authored by samsonov on Jun 15 2015, 5:27 PM.

Details

Summary

Introduce ToolChain::getSupportedSanitizers() that would return the set
of sanitizers available on given toolchain. By default, these are
sanitizers which don't necessarily require runtime support (i.e.
set from -fsanitize=undefined-trap).

Sanitizers (ASan, DFSan, TSan, MSan etc.) which cannot function
without runtime library are marked as supported only on platforms
for which we actually build these runtimes.

This would allow more fine-grained checks in the future: for instance,
we have to restrict availability of -fsanitize=vptr to Mac OS 10.9+
(PR23539)

Update test cases accrodingly: add tests for certain unsupported
configurations, remove test cases for -fsanitize=vptr + PS4
integration, as we don't build the runtime for PS4 at the moment.

Diff Detail

Repository
rL LLVM

Event Timeline

samsonov updated this revision to Diff 27734.Jun 15 2015, 5:27 PM
samsonov retitled this revision from to [Sanitizers] Provide better diagnostic for sanitizers unsupported for target triple..
samsonov updated this object.
samsonov edited the test plan for this revision. (Show Details)
samsonov added a reviewer: pcc.
samsonov added subscribers: rsmith, emaste, kubamracek and 4 others.
samsonov updated this revision to Diff 27741.Jun 15 2015, 6:11 PM
  • Add cfi-cast-strict to list of sanitizers w/o runtime.
  • Add SafeStack to the list of supported sanitizers on Darwin/Linux/FreeBSD.
pcc added inline comments.Jun 15 2015, 6:12 PM
lib/Basic/Sanitizers.cpp
69 ↗(On Diff #27734)

This should probably include CFICastStrict.

lib/Driver/MSVCToolChain.cpp
527 ↗(On Diff #27734)

CFI is not currently supported with the MSVC toolchain. Since MSVC is somewhat of a special case from CFI's perspective, I would mask it out here.

lib/Driver/SanitizerArgs.cpp
145 ↗(On Diff #27734)

Can we instead add the relevant groups to getSupportedSanitizers? I'd imagine that if a user enabled a group of which no members are supported, we'd want to diagnose it during the first pass.

samsonov updated this revision to Diff 27744.Jun 15 2015, 6:42 PM
  • Address comments by pcc@.
lib/Basic/Sanitizers.cpp
69 ↗(On Diff #27734)

Done (this and SafeStack).

lib/Driver/MSVCToolChain.cpp
527 ↗(On Diff #27734)

Done

lib/Driver/SanitizerArgs.cpp
145 ↗(On Diff #27734)

Done

I would really like to keep our current tests, but unfortunately, our ToolChain isn't upstreamed, yet. :-(
When we do it, I'll implement the remaining parts and add the checks back.

Having the toolchains have the last word on which sanitizers are supported seems like a better way to do it.
LGTM

pcc accepted this revision.Jun 17 2015, 1:07 PM
pcc edited edge metadata.

LGTM as well

This revision is now accepted and ready to land.Jun 17 2015, 1:07 PM
This revision was automatically updated to reflect the committed changes.