Skip to content

Commit c132763

Browse files
committed
Added oss-fuzz flag
1 parent d9e0ecb commit c132763

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: jerry-main/CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ endmacro()
5959
# Jerry with libfuzzer support
6060
if(JERRY_LIBFUZZER)
6161
jerry_create_executable("jerry-libfuzzer" "libfuzzer.c")
62-
target_link_libraries("jerry-libfuzzer" jerry-port-default)
62+
if(OSS_FUZZ)
63+
target_link_libraries("jerry-libfuzzer" jerry-port-default)
64+
else()
65+
target_link_libraries("jerry-libfuzzer" jerry-port-default -fsanitize=fuzzer)
66+
endif()
6367
endif()
6468

6569
# Jerry standalones

Diff for: tools/build.py

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def devhelp(helpstring):
9696
help=devhelp('build test version of the jerry command line tool (%(choices)s)'))
9797
compgrp.add_argument('--libfuzzer', metavar='X', choices=['ON', 'OFF'], type=str.upper,
9898
help=devhelp('build jerry with libfuzzer support (%(choices)s)'))
99+
compgrp.add_argument('--oss-fuzz', metavar='X', choices=['ON', 'OFF'], type=str.upper,
100+
help=devhelp('build jerry to run on OSS-fuzz (%(choices)s)'))
99101
compgrp.add_argument('--jerry-ext', metavar='X', choices=['ON', 'OFF'], type=str.upper,
100102
help='build jerry-ext (%(choices)s)')
101103
compgrp.add_argument('--jerry-libm', metavar='X', choices=['ON', 'OFF'], type=str.upper,
@@ -188,6 +190,7 @@ def build_options_append(cmakeopt, cliarg):
188190
build_options_append('JERRY_CMDLINE_SNAPSHOT', arguments.jerry_cmdline_snapshot)
189191
build_options_append('JERRY_CMDLINE_TEST', arguments.jerry_cmdline_test)
190192
build_options_append('JERRY_LIBFUZZER', arguments.libfuzzer)
193+
build_options_append('OSS_FUZZ', arguments.oss_fuzz)
191194
build_options_append('JERRY_EXT', arguments.jerry_ext)
192195
build_options_append('JERRY_LIBM', arguments.jerry_libm)
193196
build_options_append('JERRY_PORT_DEFAULT', arguments.jerry_port_default)

0 commit comments

Comments
 (0)