summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMarcos Pividori <mpividori@google.com>2017-02-10 01:40:28 +0000
committerMarcos Pividori <mpividori@google.com>2017-02-10 01:40:28 +0000
commita0b23b8e637cad82b647aee2f63799789b469a1b (patch)
tree34ddcbbbbc31409a6f41179c65e9a332bb7be6cd /llvm
parent0ae27e80b08d05d9d160e119e16a2c79d6f0817d (diff)
downloadbcm5719-llvm-a0b23b8e637cad82b647aee2f63799789b469a1b.tar.gz
bcm5719-llvm-a0b23b8e637cad82b647aee2f63799789b469a1b.zip
[libFuzzer] Export external functions on tests.
We need to export external functions so they are found when calling GetProcAddress() on Windows. But we can't use `__declspec(dllexport)` because we want the targets to be completely independent from the fuzz engines and don't depend on other header files. Also, we don't want to include platform specific code managed with conditional macros. So, the solution is to add the exported symbols with linker flags in cmake. Differential revision: https://reviews.llvm.org/D29752 llvm-svn: 294688
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Fuzzer/test/CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/CMakeLists.txt b/llvm/lib/Fuzzer/test/CMakeLists.txt
index cf9c99a36ca..890cbeef5e4 100644
--- a/llvm/lib/Fuzzer/test/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/test/CMakeLists.txt
@@ -142,6 +142,18 @@ foreach(Test ${Tests})
add_libfuzzer_test(${Test} SOURCES ${Test}.cpp)
endforeach()
+function(test_export_symbol target symbol)
+ if(MSVC)
+ set_target_properties(LLVMFuzzer-${target} PROPERTIES LINK_FLAGS
+ "-export:${symbol}")
+ endif()
+endfunction()
+
+test_export_symbol(InitializeTest "LLVMFuzzerInitialize")
+test_export_symbol(BogusInitializeTest "LLVMFuzzerInitialize")
+test_export_symbol(CustomCrossOverTest "LLVMFuzzerCustomCrossOver")
+test_export_symbol(CustomMutatorTest "LLVMFuzzerCustomMutator")
+
###############################################################################
# Unit tests
###############################################################################
OpenPOWER on IntegriCloud