blob: 252e8a35603cdbd602cdb83bda73cec38ec238ad [file] [log] [blame]
# Copyright 2023 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("tests") {
testonly = true
sources = []
deps = []
# TODO(https://fxbug.dev/408223281): Fix these tests on riscv.
if (current_cpu != "riscv64") {
sources += [ "test_unwinding.cc" ]
deps += [
":cfi_only",
":fp_only",
":scs_only",
"..",
"//src/developer/debug/shared:test_support",
"//src/lib/fxl",
"//third_party/googletest:gtest",
]
}
}
source_set("cfi_only") {
testonly = true
sources = [ "cfi_only.cc" ]
configs += [ "//build/config:no-shadow-call-stack" ]
# Some build variants explicitly require frame pointers. E.g., ASan build
# requires frame pointer and/or shadow call stack for fast unwinding. See
# //sdk/lib/c/sanitizers/backtrace.h. We generally don't want to mess it up
# so don't touch the config in these cases.
#
# Only default_frame_pointers is in the config list, the unwind tables and shadow call stacks are
# enabled implicitly in the compiler on appropriate platforms.
if (configs + [ "//build/config:default_frame_pointers" ] -
[ "//build/config:default_frame_pointers" ] != configs) {
configs -= [ "//build/config:default_frame_pointers" ]
configs += [ "//build/config:no_frame_pointers" ]
}
}
source_set("scs_only") {
testonly = true
sources = [ "scs_only.cc" ]
configs += [ ":no_unwind_tables" ]
if (configs + [ "//build/config:default_frame_pointers" ] -
[ "//build/config:default_frame_pointers" ] != configs) {
configs -= [ "//build/config:default_frame_pointers" ]
configs += [ "//build/config:no_frame_pointers" ]
}
}
source_set("fp_only") {
testonly = true
sources = [ "fp_only.cc" ]
configs += [
":no_unwind_tables",
"//build/config:no-shadow-call-stack",
]
if (configs + [ "//build/config:default_frame_pointers" ] -
[ "//build/config:default_frame_pointers" ] != configs) {
configs -= [ "//build/config:default_frame_pointers" ]
configs += [ "//build/config:frame_pointers" ]
}
}
config("no_unwind_tables") {
cflags = [
"-fno-unwind-tables",
"-fno-asynchronous-unwind-tables",
]
}