diff options
author | Petr Hosek <phosek@chromium.org> | 2018-01-30 22:59:48 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2018-01-30 22:59:48 +0000 |
commit | b1eaa56704e09077a18adb4b9d454616302c2113 (patch) | |
tree | 0f0901bc5b0b7cf32a01e8375479e06bb55b6d85 | |
parent | 0cd834ebbd22e0ac6cf4cfba70ce9d32fbc83981 (diff) | |
download | bcm5719-llvm-b1eaa56704e09077a18adb4b9d454616302c2113.tar.gz bcm5719-llvm-b1eaa56704e09077a18adb4b9d454616302c2113.zip |
[fuzzer] Update and enable libFuzzer on Fuchsia
This change updates the Fuchsia-specific code to use the C++ friendly
duration expressions and flips on the building of
libclang_rt.fuzzer-x86_64.a and similar for Fuchsia. Given that
compiler-rt doesn't build on Fuchsia, test have been run by explicitly
building the library and linking it against
lib/fuzzer/tests/FuzzerUnittest.cpp.
Differential Revision: https://reviews.llvm.org/D42670
llvm-svn: 323828
-rw-r--r-- | compiler-rt/cmake/config-ix.cmake | 2 | ||||
-rw-r--r-- | compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 16808c3cded..c7b959e79d3 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -604,7 +604,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND FUZZER_SUPPORTED_ARCH AND - OS_NAME MATCHES "Android|Darwin|Linux|NetBSD|FreeBSD") + OS_NAME MATCHES "Android|Darwin|Linux|NetBSD|FreeBSD|Fuchsia") set(COMPILER_RT_HAS_FUZZER TRUE) else() set(COMPILER_RT_HAS_FUZZER FALSE) diff --git a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp index a5fdc37fb5a..8cc9e5a3d1c 100644 --- a/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp @@ -56,7 +56,7 @@ void InterruptHandler() { void CrashHandler(zx::port *Port) { std::unique_ptr<zx::port> ExceptionPort(Port); zx_port_packet_t Packet; - ExceptionPort->wait(ZX_TIME_INFINITE, &Packet, 0); + ExceptionPort->wait(zx::time::infinite(), &Packet, 0); // Unbind as soon as possible so we don't receive exceptions from this thread. if (zx_task_bind_exception_port(ZX_HANDLE_INVALID, ZX_HANDLE_INVALID, kFuzzingCrash, 0) != ZX_OK) { @@ -117,7 +117,7 @@ void SetSignalHandler(const FuzzingOptions &Options) { } void SleepSeconds(int Seconds) { - zx::nanosleep(zx::deadline_after(ZX_SEC(Seconds))); + zx::nanosleep(zx::deadline_after(zx::sec(Seconds))); } unsigned long GetPid() { @@ -200,7 +200,7 @@ int ExecuteCommand(const Command &Cmd) { zx::process Process(ProcessHandle); // Now join the process and return the exit status. - if ((rc = Process.wait_one(ZX_PROCESS_TERMINATED, ZX_TIME_INFINITE, + if ((rc = Process.wait_one(ZX_PROCESS_TERMINATED, zx::time::infinite(), nullptr)) != ZX_OK) { Printf("libFuzzer: failed to join '%s': %s\n", Argv[0], zx_status_get_string(rc)); |