blob: ec0cccb7729250d1cab408b3c00e12e2840fda72 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT
import("//build/cpp/library_headers.gni")
import("//build/toolchain/toolchain_environment.gni")
import("//build/zircon/zircon_cpu.gni")
import("//zircon/system/ulib/hwreg/hwreg_asm_header.gni")
source_set("code-patching") {
public_deps = [ ":headers" ]
if (toolchain_environment == "kernel.phys") {
sources = [ "code-patching.cc" ]
deps = [ "//zircon/kernel/phys:main" ]
}
}
source_set("self-test") {
public = [ "include/lib/code-patching/self-test.h" ]
public_configs = [ ":headers.config" ]
sources = [ "self-test.S" ]
deps = [
":case-id-asm",
"//zircon/kernel/lib/arch",
]
}
library_headers("headers") {
headers = [
"lib/code-patching/asm.h",
"lib/code-patching/code-patches.h",
"lib/code-patching/code-patching.h",
]
public_deps = [ ":case-id-asm" ]
if (is_kernel) {
public_deps += [
"//zircon/kernel/lib/ktl:headers",
# <lib/code-patching/code-patches.h> has #include <lib/arch/cache.h>.
# <lib/code-patching/code-patching.h> has #include <lib/arch/nop.h>.
"//zircon/kernel/lib/arch:headers",
# <lib/code-patching/code-patches.h> has #include <lib/zbitl/items/bootfs.h>.
"//src/lib/zbitl:headers",
# <lib/code-patching/code-patches.h> has #include <lib/fit/result.h>.
"//sdk/lib/fit:headers",
# <lib/code-patching/code-patches.h> has #include <arch/code-patches/case-id.h>.
"//zircon/kernel/arch/$zircon_cpu/code-patches:headers",
]
}
}
hwreg_asm_header("case-id-asm") {
visibility = [ ":*" ]
output_name = "arch/code-patches/case-id-asm.h"
sources = [ "gen-case-id-asm.cc" ]
include_dirs = [ "//zircon/kernel" ]
}