| # Copyright 2019 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. |
| |
| import("//build/cpp/library_headers.gni") |
| import("//build/cpp/sdk_source_set.gni") |
| |
| library_headers("headers") { |
| headers = [ |
| "lib/zircon-internal/align.h", |
| "lib/zircon-internal/default_stack_size.h", |
| "lib/zircon-internal/device/cpu-trace/intel-pm-events.inc", |
| "lib/zircon-internal/device/cpu-trace/intel-pm.h", |
| "lib/zircon-internal/device/cpu-trace/perf-mon.h", |
| "lib/zircon-internal/device/cpu-trace/skylake-misc-events.inc", |
| "lib/zircon-internal/device/cpu-trace/skylake-pm-events.inc", |
| "lib/zircon-internal/device/cpu-trace/goldmont-pm-events.inc", |
| "lib/zircon-internal/e820.h", |
| "lib/zircon-internal/fnv1hash.h", |
| "lib/zircon-internal/ktrace-def.h", |
| "lib/zircon-internal/ktrace.h", |
| "lib/zircon-internal/macros.h", |
| "lib/zircon-internal/mtrace.h", |
| "lib/zircon-internal/paths.h", |
| "lib/zircon-internal/unique-backtrace.h", |
| "lib/zircon-internal/xorshiftrand.h", |
| ] |
| } |
| |
| sdk_source_set("zircon-internal") { |
| category = "internal" |
| public = [ |
| "include/lib/zircon-internal/align.h", |
| "include/lib/zircon-internal/default_stack_size.h", |
| "include/lib/zircon-internal/device/cpu-trace/goldmont-pm-events.inc", |
| "include/lib/zircon-internal/device/cpu-trace/intel-pm-events.inc", |
| "include/lib/zircon-internal/device/cpu-trace/intel-pm.h", |
| "include/lib/zircon-internal/device/cpu-trace/perf-mon.h", |
| "include/lib/zircon-internal/device/cpu-trace/skylake-misc-events.inc", |
| "include/lib/zircon-internal/device/cpu-trace/skylake-pm-events.inc", |
| "include/lib/zircon-internal/e820.h", |
| "include/lib/zircon-internal/fnv1hash.h", |
| "include/lib/zircon-internal/ktrace-def.h", |
| "include/lib/zircon-internal/ktrace.h", |
| "include/lib/zircon-internal/macros.h", |
| "include/lib/zircon-internal/mtrace.h", |
| "include/lib/zircon-internal/paths.h", |
| "include/lib/zircon-internal/unique-backtrace.h", |
| "include/lib/zircon-internal/xorshiftrand.h", |
| ] |
| non_sdk_deps = [ ":headers" ] |
| deps = [ "//zircon/system/public" ] |
| } |
| |
| if (!is_kernel) { |
| import("//build/components.gni") |
| import("//build/config/linker.gni") |
| import("//build/test.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":zircon-internal-tests", |
| ":zircon-internal-unittests($host_toolchain)", |
| ] |
| } |
| |
| test("zircon-internal-unittests") { |
| sources = [ "unique-backtrace-tests.cc" ] |
| |
| # Ensure aggressive ICF is enabled regardless of optimization defaults. |
| _icf = [ "//build/config:icf" ] |
| if (configs + _icf - _icf == configs) { |
| configs += [ "//build/config:icf" ] |
| } |
| |
| # The code-generation switches required for linker GC are also required for |
| # ICF, so make sure those are also enabled. |
| _linker_gc = [ "//build/config:linker_gc" ] |
| if (configs + _linker_gc - _linker_gc == configs) { |
| configs += [ "//build/config:linker_gc" ] |
| } |
| |
| # Instrumentation can prevent ICF that would otherwise happen in normal |
| # compilation, so the test code needs to know whether to test that ICF |
| # actually happened when expected or not. (It tests that as a baseline to |
| # verify that its test of preventing ICF is actually meaningful.) |
| icf_works = |
| (linker == "lld" || linker == "gold") && !toolchain_variant.instrumented |
| defines = [ "ICF_WORKS=$icf_works" ] |
| |
| deps = [ |
| ":zircon-internal", |
| "//zircon/system/ulib/zxtest", |
| ] |
| |
| if (is_fuchsia) { |
| deps += [ |
| "//src/lib/elfldltl", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| } |
| |
| fuchsia_unittest_package("zircon-internal-tests") { |
| deps = [ |
| ":zircon-internal-unittests", |
| "//src/sys/testing/elftest", |
| ] |
| } |
| } |