| # 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. |
| |
| # The test depends on UnwindLocal and doesn't work on macOS. |
| assert(!is_mac) |
| |
| source_set("tests") { |
| testonly = true |
| |
| sources = [ "test_unwinding.cc" ] |
| deps = [ |
| ":cfi_only", |
| ":fp_only", |
| ":scs_only", |
| "..", |
| "//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 //zircon/system/ulib/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", |
| ] |
| } |