Skip to content

Commit 84a3273

Browse files
committed
fix: update LLVM branch and refine sanitizer flags in CMake configurations
1 parent 7fe2d3b commit 84a3273

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

build-scripts/build_llvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def main():
304304
"default": {
305305
"repo": "https://github.com/llvm/llvm-project.git",
306306
"repo_ssh": "git@github.com:llvm/llvm-project.git",
307-
"branch": "release/18.x",
307+
"branch": "llvmorg-18.1.8",
308308
},
309309
}
310310

tests/fuzz/wasm-mutator-fuzz/CMakeLists.txt

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,19 @@ set(IWASM_DIR ${REPO_ROOT_DIR}/core/iwasm)
172172
# Global setting
173173
add_compile_options(-Wno-unused-command-line-argument)
174174

175-
# # Enable fuzzer
176-
# add_definitions(-DWASM_ENABLE_FUZZ_TEST=1)
177-
# # '-fsanitize=vptr' not allowed with '-fno-rtti
178-
# # But, LLVM by default, disables the use of `rtti` in the compiler
179-
# add_compile_options(-fsanitize=fuzzer -fno-sanitize=vptr)
180-
# add_link_options(-fsanitize=fuzzer -fno-sanitize=vptr)
181-
182-
# # Enable sanitizers if not in oss-fuzz environment
183-
# set(CFLAGS_ENV $ENV{CFLAGS})
184-
# string(FIND "${CFLAGS_ENV}" "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" FUZZ_POS)
185-
# if (FUZZ_POS GREATER -1)
186-
# set(IN_OSS_FUZZ 1)
187-
# else()
188-
# set(IN_OSS_FUZZ 0)
189-
# endif()
190-
191-
# include(${CMAKE_CURRENT_LIST_DIR}/../sanitizer_flags.cmake)
175+
# Enable sanitizers if not in oss-fuzz environment
176+
set(CFLAGS_ENV $ENV{CFLAGS})
177+
string(FIND "${CFLAGS_ENV}" "-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" FUZZ_POS)
178+
if (FUZZ_POS GREATER -1)
179+
set(IN_OSS_FUZZ 1)
180+
else()
181+
set(IN_OSS_FUZZ 0)
182+
endif()
183+
184+
# Enable fuzzer
185+
add_definitions(-DWASM_ENABLE_FUZZ_TEST=1)
186+
187+
include(${CMAKE_CURRENT_LIST_DIR}/sanitizer_flags.cmake)
192188

193189
add_subdirectory(aot-compiler)
194190
add_subdirectory(wasm-mutator)

tests/fuzz/wasm-mutator-fuzz/sanitizer_flags.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ endif()
2323
if(CMAKE_C_COMPILER_ID MATCHES ".*Clang")
2424
add_compile_options(-fno-sanitize=unsigned-integer-overflow)
2525
endif()
26+
27+
# '-fsanitize=vptr' not allowed with '-fno-rtti
28+
# But, LLVM by default, disables the use of `rtti` in the compiler
29+
add_compile_options(-fsanitize=fuzzer -fno-sanitize=vptr)
30+
add_link_options(-fsanitize=fuzzer -fno-sanitize=vptr)

0 commit comments

Comments
 (0)