blob: cd5feb1bc3d318a8280453a2e5219fdafd93ca83 [file] [log] [blame]
import("//build/arch/common.gni")
import("//build/arch/aarch64.gni") # TODO: remove when no dependency on arch_aarch64_pl011_base_address
config("compiler_defaults") {
cflags = [
"-g",
"-O2",
"-Wall",
#"-Wextra",
"-Wpedantic",
"-Werror",
]
cflags_c = [ "-std=c11" ]
cflags_cc = [ "-std=c++14" ]
if (is_debug) {
defines = [ "DEBUG=1" ]
} else {
defines = [ "DEBUG=0" ]
}
# Configuration specific for the bare metal images
if (current_toolchain == arch_toolchain) {
include_dirs = [
"//inc",
"//src/arch/${arch}/inc",
"${root_gen_dir}/inc",
]
cflags += [
"-mcpu=${arch_cpu}",
"-fno-stack-protector",
"-fno-builtin",
"-ffreestanding",
"-fpic",
]
defines += [
# TODO: move these build args for the platforms
"MAX_CPUS=8",
"MAX_VMS=16",
"STACK_SIZE=4096",
]
# TODO: this should be arch specific but it is currenly used by the
# platform generic code to map the memory
if (arch_aarch64_use_pl011) {
defines += [ "PL011_BASE=${arch_aarch64_pl011_base_address}" ]
}
}
}
config("executable_ldconfig") {
if (current_toolchain == arch_toolchain) {
ldflags = [ "--gc-sections" ]
}
}
config("sections") {
cflags = [
"-ffunction-sections",
"-fdata-sections",
]
}
config("lto") {
cflags = [ "-flto" ]
}