This is an archive of the discontinued LLVM Phabricator instance.

[SanitizerCoverage] Make Inline8bit and TracePC counters dead stripping resistant.
ClosedPublic

Authored by Dor1s on Oct 10 2018, 3:42 PM.

Details

Summary

Otherwise, at least on Mac, the linker eliminates unused symbols which
causes libFuzzer to error out due to a mismatch of the sizes of coverage tables.

Issue in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=892167

Diff Detail

Repository
rL LLVM

Event Timeline

Dor1s created this revision.Oct 10 2018, 3:42 PM
morehouse accepted this revision.Oct 10 2018, 3:46 PM
morehouse added inline comments.
lib/Transforms/Instrumentation/SanitizerCoverage.cpp
647 ↗(On Diff #169115)

Maybe do the append in CreateFunctionLocalArrayInSection to save some LOC?

This revision is now accepted and ready to land.Oct 10 2018, 3:46 PM
george.karpenkov added a subscriber: kubamracek.

Looks good to me!
@kubamracek Any extra comments?

I think we also had a hook in LLVM somewhere *not* to run -Wl,-dead_strip, maybe it could be disabled now.

Dor1s updated this revision to Diff 169217.Oct 11 2018, 8:22 AM
Dor1s marked an inline comment as done.

Move GlobalsToAppendToUsed.push_back call into CreateFunctionLocalArrayInSection

lib/Transforms/Instrumentation/SanitizerCoverage.cpp
647 ↗(On Diff #169115)

Good idea, thanks!

This revision was automatically updated to reflect the committed changes.