2025-01-13 18:38:58 +08:00
|
|
|
# Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
config("compiler_defaults") {
|
2025-01-16 15:44:56 +08:00
|
|
|
if (board_toolchain == "gcc") {
|
2025-01-13 18:38:58 +08:00
|
|
|
cflags = [
|
|
|
|
"-fPIC",
|
|
|
|
"-pthread",
|
|
|
|
]
|
2025-01-16 15:44:56 +08:00
|
|
|
} else if (board_toolchain == "riscv-gcc"){
|
|
|
|
cflags = [
|
|
|
|
"-mabi=ilp32f",
|
|
|
|
"-march=rv32imafc",
|
|
|
|
"-falign-functions=2",
|
|
|
|
"-fno-optimize-strlen",
|
|
|
|
"-freorder-blocks-algorithm=simple",
|
|
|
|
"-fno-schedule-insns",
|
|
|
|
"-fno-inline-small-functions",
|
|
|
|
"-mtune=size",
|
|
|
|
"-mno-small-data-limit=0",
|
|
|
|
"-fno-aggressive-loop-optimizations",
|
|
|
|
"-Wpointer-arith",
|
|
|
|
"-ffunction-sections",
|
|
|
|
"-fdata-sections",
|
|
|
|
"-fno-exceptions",
|
|
|
|
"-fno-short-enums",
|
|
|
|
"-nostartfiles",
|
|
|
|
"-mstrict-align",
|
|
|
|
"-Wno-error=unused-function",
|
|
|
|
"-Wno-error=unused-but-set-variable",
|
|
|
|
"-ffast-math",
|
2025-01-17 16:35:20 +08:00
|
|
|
"-ffunction-sections",
|
|
|
|
"-fdata-sections",
|
|
|
|
"-fno-common",
|
|
|
|
"-fno-builtin-printf",
|
|
|
|
"-Os",
|
|
|
|
"-msave-restore",
|
2025-01-16 15:44:56 +08:00
|
|
|
]
|
|
|
|
cflags_cc = cflags
|
|
|
|
ldflags = cflags
|
|
|
|
asmflags = cflags
|
|
|
|
|
2025-01-13 18:38:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config("executable_ldconfig") {
|
|
|
|
if (!is_mac) {
|
|
|
|
ldflags = [
|
|
|
|
"-Wl,-rpath=\$ORIGIN/",
|
|
|
|
"-Wl,-rpath-link=",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2025-01-16 15:44:56 +08:00
|
|
|
|
|
|
|
|