This is an archive of the discontinued LLVM Phabricator instance.

Teach `-fsanitize=fuzzer` to respect `-static` and `-static-libstdc++` when adding C++ standard libraries.
ClosedPublic

Authored by chandlerc on May 24 2020, 12:46 AM.

Details

Summary

Makes linking the sanitizers follow the same logic as the rest of the
driver with respect to the static linking strategy for the C++ standard
library.

Diff Detail

Event Timeline

chandlerc created this revision.May 24 2020, 12:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 24 2020, 12:46 AM
MaskRay added inline comments.
clang/lib/Driver/ToolChains/CommonArgs.cpp
754

This is correct. If GNU ld<2.25 compatibility is not needed, --push-state, -Bstatic, link, --pop-state

chandlerc marked an inline comment as done.

Ping (and adding some sanitizer folks)? I'd really love to stop building with this local patch....

clang/lib/Driver/ToolChains/CommonArgs.cpp
754

I'd prefer to keep this as-is because it matches exactly what the toolchain does elsewhere. If we want to drop support for older lds, we should update in both places.

vitalybuka accepted this revision.Oct 20 2020, 12:25 AM

LGTM, but it could be better with a test

This revision is now accepted and ready to land.Oct 20 2020, 12:25 AM
chandlerc edited the summary of this revision. (Show Details)Oct 26 2020, 5:39 PM
chandlerc updated this revision to Diff 300842.Oct 26 2020, 5:44 PM
chandlerc marked an inline comment as done.

Update with a regression test.

LGTM, but it could be better with a test

Thanks, added test and landing.