blob: cad0a0694db4ae0809f538b88385404a15b1a3db [file] [log] [blame]
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Hypervisor specific code.
source_set("src") {
sources = [
"api.c",
"cpio.c",
"cpu.c",
"load.c",
"main.c",
"vm.c",
]
deps = [
":common",
":fdt",
":fdt_handler",
":memiter",
":mm",
]
if (is_debug) {
deps += [ ":dlog" ]
}
}
# Code that is not specific to a certain image so can be shared.
source_set("common") {
sources = [
"std.c",
]
}
# Debug code that is not specific to a certain image so can be shared.
source_set("dlog") {
sources = [
"dlog.c",
]
deps = [
":common",
"//src/arch/${arch}:putchar",
]
}
source_set("fdt") {
sources = [
"fdt.c",
]
deps = [
":common",
]
if (is_debug) {
deps += [ ":dlog" ]
}
}
source_set("fdt_handler") {
sources = [
"fdt_handler.c",
]
deps = [
":common",
":fdt",
]
if (is_debug) {
deps += [ ":dlog" ]
}
}
source_set("memiter") {
sources = [
"memiter.c",
]
}
source_set("mm") {
sources = [
"alloc.c",
"mm.c",
]
deps = []
if (is_debug) {
deps += [ ":dlog" ]
}
}
executable("unit_tests") {
testonly = true
sources = [
"abi_test.cc",
"fdt_handler_test.cc",
"fdt_test.cc",
"mm_test.cc",
]
cflags_cc = [
"-Wno-c99-extensions",
"-Wno-nested-anon-types",
]
ldflags = [
"-Xlinker",
"-defsym=text_begin=0",
"-Xlinker",
"-defsym=text_end=100",
"-Xlinker",
"-defsym=rodata_begin=200",
"-Xlinker",
"-defsym=rodata_end=300",
"-Xlinker",
"-defsym=data_begin=400",
"-Xlinker",
"-defsym=data_end=500",
"-Xlinker",
"-defsym=bin_end=600",
]
deps = [
":fdt",
":fdt_handler",
":mm",
"//third_party:gtest_main",
]
}