Skip to content

Commit 018efe6

Browse files
committed
cmake: introduce option ENABLE_LIBFUZZER_STATIC_LINKAGE
The patch itnroduces a CMake option ENABLE_LIBFUZZER_STATIC_LINKAGE that enables static linkage wituh libFuzzer. By default linkage is disabled. Needed for google/oss-fuzz#14610
1 parent 06292f8 commit 018efe6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ option(ENABLE_BONUS_TESTS "Enable bonus tests" OFF)
2222
option(ENABLE_INTERNAL_TESTS "Enable internal tests" OFF)
2323
option(ENABLE_LAPI_TESTS "Enable Lua API tests" OFF)
2424
option(ENABLE_CBMC_PROOFS "Enable CBMC proofs" OFF)
25+
option(ENABLE_LIBFUZZER_STATIC_LINKAGE "Enable static libFuzzer linkage" OFF)
2526

2627
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
2728
set(CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_INCLUDE_PATH})
@@ -37,7 +38,7 @@ endif()
3738
# resulting in drastically slower execution speeds, crash
3839
# reproduction failures, or inaccurate coverage reports.
3940
# Disable libFuzzer static linkage when code coverage is enabled.
40-
if (ENABLE_LAPI_TESTS AND NOT ENABLE_COV)
41+
if (ENABLE_LAPI_TESTS AND ENABLE_LIBFUZZER_STATIC_LINKAGE AND NOT ENABLE_COV)
4142
message(STATUS "libFuzzer static linkage is enabled")
4243
include(LibFuzzer)
4344
SetLibFuzzerPath(FUZZER_NO_MAIN_LIBRARY)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ is LuaJIT-specific.
6464
- `ENABLE_INTERNAL_TESTS` enables internal tests.
6565
- `ENABLE_LAPI_TESTS` enables Lua API tests.
6666
- `ENABLE_CBMC_PROOFS` enables building CBMC proofs instead tests.
67+
- `ENABLE_LIBFUZZER_STATIC_LINKAGE` enables static libFuzzer linkage.
6768

6869
### Running
6970

0 commit comments

Comments
 (0)