From 9ea7fbd1e862095dd85ebf135b53dcd52d95bfef Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Thu, 12 Oct 2017 04:35:32 +0000 Subject: Re-commit "llvm-isel-fuzzer: Handle a subset of backend flags in the exec name" Here we add a secondary option parser to llvm-isel-fuzzer (and provide it for use with other fuzzers). With this, you can copy the fuzzer to a name like llvm-isel-fuzzer=aarch64-gisel for a fuzzer that fuzzer AArch64 with GlobalISel enabled, or fuzzer=x86_64 to fuzz x86, with no flags required. This should be useful for running these in OSS-Fuzz. Note that this handrolls a subset of cl::opts to recognize, rather than embedding a complete command parser for argv[0]. If we find we really need the flexibility of handling arbitrary options at some point we can rethink this. This re-applies 315545 using "=" instead of ":" as a separator for arguments. llvm-svn: 315557 --- llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/tools/llvm-isel-fuzzer') diff --git a/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp b/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp index 314acdb5087..9b39483c1aa 100644 --- a/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp +++ b/llvm/tools/llvm-isel-fuzzer/llvm-isel-fuzzer.cpp @@ -150,11 +150,12 @@ extern "C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize(int *argc, InitializeAllAsmPrinters(); InitializeAllAsmParsers(); + handleExecNameEncodedBEOpts(*argv[0]); parseFuzzerCLOpts(*argc, *argv); if (TargetTriple.empty()) { errs() << *argv[0] << ": -mtriple must be specified\n"; - return 1; + exit(1); } Triple TheTriple = Triple(Triple::normalize(TargetTriple)); -- cgit v1.2.3