mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-30 23:20:54 +00:00
8bb56ccbc0
The motivation for this change is to fix linking issues on OSX. However this only partially fixes linking issues (the uninstrumented tests and a few others won't succesfully link yet). This change introduces a struct of function pointers (``fuzzer::ExternalFuntions``) which when initialised will point to the optional functions if they are available. Currently these ``LLVMFuzzerInitialize`` and ``LLVMFuzzerCustomMutator`` functions. Two implementations of ``fuzzer::ExternalFunctions`` constructor are provided one for Linux and one for OSX. The OSX implementation uses ``dlsym()`` because the prior implementation using weak symbols does not work unless the additional flags are passed to the linker. The Linux implementation continues to use weak symbols because the ``dlsym()`` approach does not work unless additional flags are passed to the linker. Differential Revision: http://reviews.llvm.org/D20741 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271491 91177308-0d34-0410-b5e6-96231b3b80d8
23 lines
748 B
C++
23 lines
748 B
C++
//===- FuzzerMain.cpp - main() function and flags -------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
// main() and flags.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "FuzzerInterface.h"
|
|
#include "FuzzerInternal.h"
|
|
|
|
extern "C" {
|
|
// This function should be defined by the user.
|
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
|
|
} // extern "C"
|
|
|
|
int main(int argc, char **argv) {
|
|
return fuzzer::FuzzerDriver(&argc, &argv, LLVMFuzzerTestOneInput);
|
|
}
|