| # Copyright 2018 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| # This config is included for every fuzz target. | |
| # You can add anything in here that's valid in a target dictionary. | |
| # Fuzzing only works for amd64 boards at this point. | |
| config("common_fuzzer") { | |
| cflags = [] | |
| ldflags = [] | |
| if (use.asan) { | |
| cflags += [ "-fsanitize=address" ] | |
| ldflags += [ "-fsanitize=address" ] | |
| } | |
| if (use.coverage) { | |
| cflags += [ | |
| "-fprofile-instr-generate", | |
| "-fcoverage-mapping", | |
| ] | |
| ldflags += [ | |
| "-fprofile-instr-generate", | |
| "-fcoverage-mapping", | |
| ] | |
| } | |
| if (use.fuzzer) { | |
| cflags += [ "-fsanitize=fuzzer-no-link" ] | |
| ldflags += [ "-fsanitize=fuzzer" ] | |
| } | |
| if (use.msan) { | |
| cflags += [ "-fsanitize=memory" ] | |
| ldflags += [ "-fsanitize=memory" ] | |
| } | |
| if (use.ubsan) { | |
| cflags += [ | |
| "-fsanitize=undefined", | |
| "-fno-sanitize=vptr", | |
| ] | |
| ldflags += [ | |
| "-fsanitize=undefined", | |
| "-fno-sanitize=vptr", | |
| ] | |
| } | |
| } |