This is an archive of the discontinued LLVM Phabricator instance.

Driver: Stop linking to C++ when using sanitizers on Darwin
ClosedPublic

Authored by kastiglione on Jul 5 2016, 2:21 PM.

Details

Reviewers
compnerd
beanz
Summary

Sanitizers on Darwin are built as dynamic libraries, not static libraries. Sanitizers will have their C++ dependency satisfied internally (LC_LOAD_DYLIB) in the libclang_rt dylib. As long as the sanitizers stay dynamic and not static, linking against C++ when enabling a sanitizer becomes over linkage.

Diff Detail

Event Timeline

kastiglione updated this revision to Diff 62789.Jul 5 2016, 2:21 PM
kastiglione retitled this revision from to Driver: Stop linking to C++ when using sanitizers on Darwin.
kastiglione updated this object.
kastiglione added reviewers: compnerd, beanz.
compnerd edited edge metadata.Jul 5 2016, 5:48 PM

Similar on all the sanitizers.

test/Driver/darwin-sanitizer-ld.c
8

I think that this can be made into a stronger assertion. Changing it to:

// CHECK-ASAN-NOT: stdc++

seems better.

While you are here, can you double up the tests and check against both libstdc++ and libc++?

kastiglione updated this revision to Diff 62889.Jul 6 2016, 9:40 AM
kastiglione edited edge metadata.

Add CHECK-NOTs for C++

kastiglione updated this object.Jul 6 2016, 10:03 AM
kastiglione marked an inline comment as done.Jul 6 2016, 12:04 PM

LGTM; @beanz, any objections to this?

compnerd accepted this revision.Jul 7 2016, 10:02 AM
compnerd edited edge metadata.

Spoke with @beanz offline, he didnt have any concerns with this.

This revision is now accepted and ready to land.Jul 7 2016, 10:02 AM
compnerd closed this revision.Jul 7 2016, 2:51 PM

SVN r274797