This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Allow sanitize coverage w/o sanitizers.
ClosedPublic

Authored by eugenis on Jun 13 2016, 5:37 PM.

Details

Reviewers
kcc
pcc
Summary

The reason is that this (a) seems to work just fine and (b) is useful when building stuff with
sanitizer+coverage, but needing to exclude the sanitizer for a particular source file.

Diff Detail

Repository
rL LLVM

Event Timeline

eugenis updated this revision to Diff 60635.Jun 13 2016, 5:37 PM
eugenis retitled this revision from to [sanitizer] Allow sanitize coverage w/o sanitizers..
eugenis updated this object.
eugenis added reviewers: pcc, kcc.
eugenis set the repository for this revision to rL LLVM.
eugenis added a subscriber: cfe-commits.

For the context, this is supposed to fix this problem:
https://bugs.chromium.org/p/chromium/issues/detail?id=618534

Of course there are other ways of dealing with that that do not require changing the compiler, but this change seems like the right thing to do. The limitation on the standalone use of coverage seems arbitrary.

kcc edited edge metadata.Jun 14 2016, 8:10 AM

What run-time is going to be linked when coverage is used w/o any of the sanitizers?

ubsan_standalone (that's what the needsUbsanRt change is for).

kcc added a comment.Jun 14 2016, 11:57 AM

Can you at least add a compiler-rt test where we ensure that this flag can not be used such that it wil compile but fail to link?

E.g.

clang -fsanitize-coverage=edge x.c

should compile *and* link (and run)

In D21317#457784, @kcc wrote:

Can you at least add a compiler-rt test where we ensure that this flag can not be used such that it wil compile but fail to link?

E.g.

clang -fsanitize-coverage=edge x.c

should compile *and* link (and run)

D21339

kcc accepted this revision.Jun 14 2016, 2:21 PM
kcc edited edge metadata.

LGTM
Please also check if the documentation needs to be updated.

This revision is now accepted and ready to land.Jun 14 2016, 2:21 PM
eugenis updated this revision to Diff 60759.Jun 14 2016, 2:40 PM
eugenis edited edge metadata.

+ docs

eugenis closed this revision.Jun 17 2016, 1:38 PM

r272717