73 lines
2.6 KiB
Python
73 lines
2.6 KiB
Python
# Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
|
|
# source code may only be used and distributed under the Widevine
|
|
# License Agreement.
|
|
|
|
# gypi file to be included using --includes option while building oemcrypto
|
|
# opk fuzz binaries. OPK classes needs to be instrumented with fuzzer
|
|
# but only when being built for fuzzing. Instead of directly updating
|
|
# oemcrypto_ta.gyp target, we use gypi in build_oemcrypto_fuzztests script.
|
|
{
|
|
'target_defaults': {
|
|
'variables': {
|
|
# Flag used to generate source based code coverage reports.
|
|
'generate_code_coverage_report%': 'false',
|
|
# Flag to indicate that the code is being built with libFuzzer
|
|
# instrumentation enabled.
|
|
'enable_fuzzing_instrumentation': 'true',
|
|
},
|
|
# Include flags to build fuzzer binaries to generate source based code coverage reports.
|
|
'cflags': [
|
|
'-fPIC',
|
|
'-O0',
|
|
'-fno-omit-frame-pointer',
|
|
'-U_FORTIFY_SOURCE',
|
|
'-fsanitize=fuzzer,address,undefined',
|
|
'-fno-sanitize-recover=address,undefined',
|
|
# Need -g flag to include source line numbers in error stack trace.
|
|
'-g3',
|
|
],
|
|
'cflags_c': [
|
|
'-std=c11',
|
|
'-D_POSIX_C_SOURCE=200809L',
|
|
],
|
|
'cflags_cc' : [
|
|
'-frtti',
|
|
'-std=c++17',
|
|
],
|
|
'ldflags': [
|
|
'-fPIC',
|
|
# Sanitizers with link-time components must be repeated here.
|
|
'-fsanitize=address',
|
|
# Fuzzer is put on its own line so targets that need to swap it for
|
|
# the version without a main function can easily find it.
|
|
'-fsanitize=fuzzer',
|
|
],
|
|
'libraries': [
|
|
'-lpthread',
|
|
],
|
|
'defines': [
|
|
'OPK_LOG_LEVEL=LOG_NONE',
|
|
'OPK_CONFIG_SOC_VENDOR_NAME=test',
|
|
'OPK_CONFIG_SOC_MODEL_NAME=test',
|
|
'OPK_CONFIG_TEE_OS_NAME=TEE_Simulator',
|
|
'OPK_CONFIG_TEE_OS_VERSION=0.0.0',
|
|
'OPK_CONFIG_DEVICE_FORM_FACTOR=oemcrypto_opk_fuzztests',
|
|
'OPK_CONFIG_IMPLEMENTER_NAME=Widevine',
|
|
'FACTORY_BUILD_ONLY',
|
|
],
|
|
'conditions': [
|
|
['generate_code_coverage_report=="true"', {
|
|
# Include flags to build fuzzer binaries to generate source based code coverage reports.
|
|
'cflags': [
|
|
'-fprofile-instr-generate',
|
|
'-fcoverage-mapping',
|
|
],
|
|
'ldflags': [
|
|
'-fprofile-instr-generate',
|
|
'-fcoverage-mapping',
|
|
],
|
|
}],
|
|
],
|
|
},
|
|
}
|