This is an archive of the discontinued LLVM Phabricator instance.

[libfuzzer] Use cl driver mode for tests and enable another test on Windows
ClosedPublic

Authored by metzman on Sep 6 2018, 3:35 PM.

Details

Summary

When targeting MSVC: compile using clang's cl driver mode (this is needed for
libfuzzer's exit_on_src_pos feature). Don't use -lstdc++ when linking,
it isn't needed and causes a warning.
On Windows: Fix exit_on_src_pos.test by making sure debug info isn't
overwritten during compilation of second binary by using .exe extension.

Diff Detail

Event Timeline

metzman created this revision.Sep 6 2018, 3:35 PM
metzman retitled this revision from [libfuzzer] Use compilation flags for tests and enable another one on Windws to [libfuzzer] Use correct compilation flags for tests and enable another one on Windws.Sep 6 2018, 3:36 PM
metzman retitled this revision from [libfuzzer] Use correct compilation flags for tests and enable another one on Windws to [libfuzzer] Use cl driver mode for tests and enable another one on Windws.Sep 6 2018, 3:48 PM
metzman edited the summary of this revision. (Show Details)
metzman updated this revision to Diff 164301.Sep 6 2018, 3:49 PM
  • Remove /Z7 flag.
metzman updated this revision to Diff 164304.Sep 6 2018, 3:51 PM
  • undo accidental change

Matt, please take a look when you get a chance (no rush).

I suspect this is the last exe related problem, but there may be others that have this problem combined with another (like exit_on_src.pos did).

Also, do you know if there is a way to conditionally add a compile flag to a particular compile command in a lit file? If I ever need to add a windows only flag to just one command, I'm not sure what I would need to do (maybe a separate lit file? or I can define an expansion?).

By the way, I can commit this one myself (hooray!)

metzman added inline comments.Sep 6 2018, 4:06 PM
compiler-rt/test/fuzzer/exit_on_src_pos.test
9 ↗(On Diff #164304)

I'm not sure why this line has so much whitespace, do you think I should get rid of it.

metzman retitled this revision from [libfuzzer] Use cl driver mode for tests and enable another one on Windws to [libfuzzer] Use cl driver mode for tests and enable another one on Windows.Sep 6 2018, 4:19 PM
morehouse added inline comments.Sep 6 2018, 5:26 PM
compiler-rt/test/fuzzer/exit_on_src_pos.test
9 ↗(On Diff #164304)

Yes, please fix whitespace.

compiler-rt/test/fuzzer/lit.cfg
72 ↗(On Diff #164304)

Should we be checking config.target_triple instead?

metzman updated this revision to Diff 164342.Sep 6 2018, 5:48 PM
metzman marked 3 inline comments as done.
  • remove extra whitespace.
  • use target triple
metzman added inline comments.Sep 6 2018, 5:50 PM
compiler-rt/test/fuzzer/exit_on_src_pos.test
9 ↗(On Diff #164304)

Done

compiler-rt/test/fuzzer/lit.cfg
72 ↗(On Diff #164304)

Good idea. Done.

morehouse accepted this revision.Sep 6 2018, 5:56 PM
This revision is now accepted and ready to land.Sep 6 2018, 5:56 PM
metzman retitled this revision from [libfuzzer] Use cl driver mode for tests and enable another one on Windows to [libfuzzer] Use cl driver mode for tests and enable another test on Windows.Sep 6 2018, 6:11 PM
metzman edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.
Herald added subscribers: Restricted Project, llvm-commits. · View Herald TranscriptSep 6 2018, 6:12 PM