-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luzer module requires linking with a library `clang_rt.fuzzer_no_main-x86_64` that is a part of a Clang runtime. Without linking with it Lua runtime will report an error right on loading `luzer.so`: lua5.1: error loading module 'luzer' from file './luzer.so': ./luzer.so: undefined symbol: __sanitizer_cov_8bit_counters_init The patch adds a module that composes a path to Clang runtime libraries and adds this path to a library search paths.
- Loading branch information
Showing
3 changed files
with
32 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# The function sets the given variable in a parent scope to a | ||
# value in CLANG_RT_LIB_DIR environment variable if it | ||
# is set. Otherwise the value with path to a directory with | ||
# Clang RT libraries is composed manually. Function raises | ||
# a fatal message if C compiler is not Clang. | ||
|
||
function(SetClangRTLibDir outvar) | ||
set(ClangRTLibDir $ENV{CLANG_RT_LIB_DIR}) | ||
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") | ||
message(FATAL_ERROR "C compiler is not a Clang") | ||
endif () | ||
if (NOT ClangRTLibDir) | ||
string(REPLACE "." ";" VERSION_LIST ${CMAKE_C_COMPILER_VERSION}) | ||
list(GET VERSION_LIST 0 CLANG_VERSION_MAJOR) | ||
# Clang >= 15: /usr/lib/llvm-xxx/lib/clang/X/lib/linux/ | ||
# Clang < 15: /usr/lib/llvm-xxx/lib/clang/X.Y.Z/lib/linux/ | ||
set(CLANG_VERSION ${CMAKE_C_COMPILER_VERSION}) | ||
if (CLANG_VERSION_MAJOR GREATER 15) | ||
set(CLANG_VERSION ${CLANG_VERSION_MAJOR}) | ||
endif () | ||
set(ClangRTLibDir "/usr/lib/llvm-${CLANG_VERSION_MAJOR}/lib/clang/${CLANG_VERSION}/lib/linux/") | ||
endif () | ||
set(${outvar} ${ClangRTLibDir} PARENT_SCOPE) | ||
message(STATUS "[SetClangRTLibDir] ${outvar} is ${ClangRTLibDir}") | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters