This is an archive of the discontinued LLVM Phabricator instance.

[libFuzzer] Diff 5 - Split FuzzerExtFunction implementation for Linux, Apple and Windows.
ClosedPublic

Authored by mpividori on Nov 29 2016, 3:29 PM.

Details

Diff Detail

Repository
rL LLVM

Event Timeline

mpividori updated this revision to Diff 79658.Nov 29 2016, 3:29 PM
mpividori retitled this revision from to [libFuzzer] Diff 5 - Split FuzzerExtFunction implementation for Linux, Apple and Windows..
mpividori updated this object.
mpividori added reviewers: kcc, zturner.
mpividori set the repository for this revision to rL LLVM.
mpividori added a subscriber: llvm-commits.
zturner accepted this revision.Nov 30 2016, 9:59 AM
zturner edited edge metadata.

This one looks fine, but since I'm not sure which CLs depend on which other CLs, to avoid weird merge conflicts I will wait until the first ones go in before submitting this.

This revision is now accepted and ready to land.Nov 30 2016, 9:59 AM
kcc added inline comments.Nov 30 2016, 6:22 PM
lib/Fuzzer/CMakeLists.txt
14 ↗(On Diff #79658)

do you have to change the file names?
We've spent quite some time with the Apple folks bike-shedding about these names...

mpividori added inline comments.Nov 30 2016, 7:15 PM
lib/Fuzzer/CMakeLists.txt
14 ↗(On Diff #79658)

@kcc We have 3 different implementations, one for Windows, one for Apple and one for Linux. So I thought it would be sensible to name the files this way. What would you suggest?

kcc edited edge metadata.Dec 1 2016, 3:08 PM

Look at it from another side.
What if we decide to switch Linux implementation to use dlsym?
Or what if we port to FreeBSD, where "weak" works equally well.

My suggestion is to not rename the existing files and to call the new file
FuzzerExtFunctionsWindows.cpp or FuzzerExtFunctionsWeakAlias.cpp

@kcc Yes, I agree. I will change that. Thanks

mpividori updated this revision to Diff 80005.Dec 1 2016, 5:48 PM
mpividori edited edge metadata.

Done.

kcc added inline comments.Dec 1 2016, 6:16 PM
lib/Fuzzer/FuzzerCorpus.h
17 ↗(On Diff #80005)

is this a related change?

lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp
17 ↗(On Diff #80005)

do you need this change here?

lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
16 ↗(On Diff #80005)

do you need this change here?

lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp
9 ↗(On Diff #80005)

Implementation using weak aliases. Works for Windows.

mpividori added inline comments.Dec 2 2016, 8:56 AM
lib/Fuzzer/FuzzerCorpus.h
17 ↗(On Diff #80005)

That header is required to include std::iota() declaration, in Windows. It is a detail, if you prefer, I can add that line in a different diff.
I apologize for these unrelated "details". This is the result of splitting a previous diff into many diffs.
Now that I understand how the review system works, I will be more careful with future diffs.

lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp
17 ↗(On Diff #80005)

@kcc Yes, it is needed to use the Printf() function.

lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
16 ↗(On Diff #80005)

@kcc I remove an empty line, so the 3 files FuzzerExtFunctions*.cpp have the same format. If you prefer, I can remove that change.

lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp
9 ↗(On Diff #80005)

@kcc Ok, I will add that comment.

mpividori updated this revision to Diff 80076.Dec 2 2016, 9:06 AM

+ Remove unrelated changes.

kcc accepted this revision.Dec 2 2016, 9:49 AM
kcc edited edge metadata.

LGTM

This revision was automatically updated to reflect the committed changes.