Upgrade bazel to 4.0.0rc2
A few things of note here:
- I disabled a few incompatible flags in order to minimize the number
of changes we have to deal with.
- I had to upgrade the typescript rules because the old ones didn't
work with new bazel anymore. That brought a typescript compiler
upgrade along. This in turn required me to turn off strict mode.
Otherwise, there are a _ton_ of errors in our typescript files. The
vast majority of them are related to `null` checking.
- The `default_python_version` attribute on Python rules doesn't exist
anymore. It's now replaced by `python_version`.
- I removed the CROSSTOOL in favour of a Starlark-equivalent
configuration function. See `tools/cpp/toolchain_config.bzl` for
more details. This new file is auto-generated using the migration
tools from `rules_cc`. I have made no attempt to beautify this file.
Relatedly, all CROSSTOOL-related files/functionality are gone as well.
- The `config_setting` targets to detect the compiler names had to
change. This is perhaps not surprising. Thanks to Austin for
pointing this out to me.
- The `cc_toolchain` targets all required `ar_files` and `as_files`
attributes where they didn't before. Not really sure what changed,
but the compilations appears to work with these changes.
Change-Id: I2317e5160fa3f8d87f94106b0c3b328918d0c42c
diff --git a/tools/BUILD b/tools/BUILD
index 50ba0bb..50c9141 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -5,12 +5,16 @@
# Don't use these directly! Use //tools/build_rules/*.bzl instead.
config_setting(
name = "compiler_clang",
- values = {"compiler": "clang"},
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "clang",
+ }
)
config_setting(
name = "compiler_gcc",
- values = {"compiler": "gcc"},
+ flag_values = {
+ "@bazel_tools//tools/cpp:compiler": "gcc",
+ }
)
config_setting(
diff --git a/tools/bazel b/tools/bazel
index b4293a1..36e88ae 100755
--- a/tools/bazel
+++ b/tools/bazel
@@ -24,7 +24,7 @@
exec "${BAZEL_OVERRIDE}" "$@"
fi
-readonly VERSION="0.19.0rc4-201810201638+ac88041"
+readonly VERSION="4.0.0rc2-202011211956+37a429ad12"
readonly DOWNLOAD_DIR="${HOME}/.cache/bazel"
# Directory to unpack bazel into. This must change whenever bazel changes.
diff --git a/tools/cpp/BUILD b/tools/cpp/BUILD
index fd41261..d370750 100644
--- a/tools/cpp/BUILD
+++ b/tools/cpp/BUILD
@@ -1,5 +1,14 @@
+load(":toolchain_config.bzl", "cc_toolchain_config")
+
package(default_visibility = ["//visibility:public"])
+[cc_toolchain_config(
+ name = "{}_toolchain_config".format(cpu),
+ cpu = cpu,
+) for cpu in
+ ["armeabi-v7a", "armhf-debian", "cortex-m4f", "cortex-m4f-k22", "k8", "roborio"]
+]
+
cc_library(
name = "empty_main",
srcs = ["empty_main.c"],
@@ -29,11 +38,11 @@
cc_toolchain_suite(
name = "toolchain",
toolchains = {
- "k8|clang": ":cc-compiler-k8",
- "roborio|gcc": ":cc-compiler-roborio",
- "armhf-debian|clang": "cc-compiler-armhf-debian",
- "cortex-m4f|gcc": "cc-compiler-cortex-m4f",
- "cortex-m4f-k22|gcc": "cc-compiler-cortex-m4f-k22",
+ "k8": ":cc-compiler-k8",
+ "roborio": ":cc-compiler-roborio",
+ "armhf-debian": "cc-compiler-armhf-debian",
+ "cortex-m4f": "cc-compiler-cortex-m4f",
+ "cortex-m4f-k22": "cc-compiler-cortex-m4f-k22",
},
)
@@ -62,6 +71,14 @@
)
filegroup(
+ name = "clang_6p0_ar_files",
+ srcs = [
+ "//tools/cpp/clang_6p0:ar",
+ "@clang_6p0_repo//:compiler_pieces",
+ ],
+)
+
+filegroup(
name = "clang_6p0_linker_files",
srcs = [
"//tools/cpp/clang_6p0:ar",
@@ -95,15 +112,15 @@
name = "cc-compiler-k8",
all_files = ":clang_6p0_all_files",
compiler_files = ":clang_6p0_compiler_files",
- cpu = "k8",
dwp_files = ":empty",
- dynamic_runtime_libs = [":empty"],
linker_files = ":clang_6p0_linker_files",
+ ar_files = ":clang_6p0_ar_files",
+ as_files = ":clang_6p0_compiler_files",
objcopy_files = "//tools/cpp/clang_6p0:objcopy",
- static_runtime_libs = [":empty"],
strip_files = ":clang_6p0_strip_files",
supports_param_files = 1,
toolchain_identifier = "k8_linux",
+ toolchain_config = ":k8_toolchain_config",
)
filegroup(
@@ -128,6 +145,14 @@
)
filegroup(
+ name = "roborio_ar_files",
+ srcs = [
+ "//tools/cpp/arm-frc-linux-gnueabi:ar",
+ "@arm_frc_linux_gnueabi_repo//:compiler_pieces",
+ ],
+)
+
+filegroup(
name = "roborio_compiler_files",
srcs = [
"//tools/cpp/arm-frc-linux-gnueabi:gcc",
@@ -149,15 +174,15 @@
name = "cc-compiler-roborio",
all_files = ":roborio-compiler-files",
compiler_files = ":roborio_compiler_files",
- cpu = "roborio",
dwp_files = ":empty",
- dynamic_runtime_libs = [":empty"],
linker_files = ":roborio_linker_files",
+ ar_files = ":roborio_ar_files",
+ as_files = ":roborio_compiler_files",
objcopy_files = "//tools/cpp/arm-frc-linux-gnueabi:objcopy",
- static_runtime_libs = [":empty"],
strip_files = ":roborio_strip_files",
supports_param_files = 1,
toolchain_identifier = "roborio_linux",
+ toolchain_config = ":roborio_toolchain_config",
)
filegroup(
@@ -185,6 +210,14 @@
)
filegroup(
+ name = "linaro_linux_ar_files",
+ srcs = [
+ "//tools/cpp/linaro_linux_gcc:ar",
+ "@linaro_linux_gcc_repo//:compiler_pieces",
+ ],
+)
+
+filegroup(
name = "linaro_linux_compiler_files",
srcs = [
":clang_6p0_compiler_files",
@@ -208,15 +241,15 @@
name = "cc-compiler-armhf-debian",
all_files = ":linaro-gcc-files",
compiler_files = ":linaro_linux_compiler_files",
- cpu = "armhf",
dwp_files = ":empty",
- dynamic_runtime_libs = [":empty"],
linker_files = ":linaro_linux_linker_files",
+ ar_files = "linaro_linux_ar_files",
+ as_files = "linaro_linux_compiler_files",
objcopy_files = "//tools/cpp/linaro_linux_gcc:objcopy",
- static_runtime_libs = [":empty"],
strip_files = ":linaro_linux_strip_files",
supports_param_files = 1,
toolchain_identifier = "clang_linux_armhf",
+ toolchain_config = ":armhf-debian_toolchain_config",
)
filegroup(
@@ -233,6 +266,7 @@
"//tools/cpp/gcc_arm_none_eabi:as",
"//tools/cpp/gcc_arm_none_eabi:gcc",
"//tools/cpp/gcc_arm_none_eabi:ld",
+ "@gcc_arm_none_eabi//:compiler_pieces",
],
)
@@ -247,41 +281,37 @@
],
)
+filegroup(
+ name = "gcc_arm_none_eabi_ar_files",
+ srcs = [
+ "//tools/cpp/gcc_arm_none_eabi:ar",
+ "@gcc_arm_none_eabi//:compiler_pieces",
+ ],
+)
+
cc_toolchain(
name = "cc-compiler-cortex-m4f",
all_files = ":gcc_arm_none_eabi_none_files",
compiler_files = ":gcc_arm_none_eabi_compiler_files",
- cpu = "cortex-m4f",
dwp_files = ":empty",
- dynamic_runtime_libs = [":empty"],
linker_files = ":gcc_arm_none_eabi_linker_files",
+ ar_files = ":gcc_arm_none_eabi_ar_files",
objcopy_files = "//tools/cpp/gcc_arm_none_eabi:objcopy",
- static_runtime_libs = [":empty"],
strip_files = "//tools/cpp/gcc_arm_none_eabi:strip",
supports_param_files = 1,
toolchain_identifier = "cortex-m4f",
+ toolchain_config = ":cortex-m4f_toolchain_config",
)
cc_toolchain(
name = "cc-compiler-cortex-m4f-k22",
all_files = ":gcc_arm_none_eabi_none_files",
compiler_files = ":gcc_arm_none_eabi_compiler_files",
- cpu = "cortex-m4f-k22",
dwp_files = ":empty",
- dynamic_runtime_libs = [":empty"],
linker_files = ":gcc_arm_none_eabi_linker_files",
objcopy_files = ":empty",
- static_runtime_libs = [":empty"],
strip_files = ":empty",
supports_param_files = 1,
toolchain_identifier = "cortex-m4f-k22",
-)
-
-py_binary(
- name = "gen_crosstool",
- srcs = ["gen_crosstool.py"],
- main = "gen_crosstool.py",
- deps = [
- "//third_party/bazel:crosstool_config_proto_py",
- ],
+ toolchain_config = ":cortex-m4f-k22_toolchain_config",
)
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
deleted file mode 100644
index c050873..0000000
--- a/tools/cpp/CROSSTOOL
+++ /dev/null
@@ -1,1362 +0,0 @@
-# GENERATED FILE. DO NOT EDIT
-# Generated by tools/cpp/gen_crosstool.py
-major_version: "local"
-minor_version: ""
-default_target_cpu: "same_as_host"
-default_toolchain {
- cpu: "roborio"
- toolchain_identifier: "roborio_linux"
-}
-default_toolchain {
- cpu: "k8"
- toolchain_identifier: "k8_linux"
-}
-default_toolchain {
- cpu: "armeabi-v7a"
- toolchain_identifier: "stub_armeabi-v7a"
-}
-default_toolchain {
- cpu: "armhf-debian"
- toolchain_identifier: "clang_linux_armhf"
-}
-default_toolchain {
- cpu: "cortex-m4f"
- toolchain_identifier: "cortex-m4f"
-}
-default_toolchain {
- cpu: "cortex-m4f-k22"
- toolchain_identifier: "cortex-m4f-k22"
-}
-toolchain {
- toolchain_identifier: "stub_armeabi-v7a"
- host_system_name: "armeabi-v7a"
- target_system_name: "armeabi-v7a"
- target_cpu: "armeabi-v7a"
- target_libc: "armeabi-v7a"
- compiler: "compiler"
- abi_version: "armeabi-v7a"
- abi_libc_version: "armeabi-v7a"
- tool_path {
- name: "ar"
- path: "/bin/false"
- }
- tool_path {
- name: "compat-ld"
- path: "/bin/false"
- }
- tool_path {
- name: "cpp"
- path: "/bin/false"
- }
- tool_path {
- name: "dwp"
- path: "/bin/false"
- }
- tool_path {
- name: "gcc"
- path: "/bin/false"
- }
- tool_path {
- name: "gcov"
- path: "/bin/false"
- }
- tool_path {
- name: "ld"
- path: "/bin/false"
- }
- tool_path {
- name: "nm"
- path: "/bin/false"
- }
- tool_path {
- name: "objcopy"
- path: "/bin/false"
- }
- tool_path {
- name: "objdump"
- path: "/bin/false"
- }
- tool_path {
- name: "strip"
- path: "/bin/false"
- }
- supports_gold_linker: false
- supports_thin_archives: false
- needsPic: true
- builtin_sysroot: ""
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_interface_shared_objects: false
- supports_incremental_linker: false
- supports_fission: false
-}
-toolchain {
- toolchain_identifier: "k8_linux"
- host_system_name: "local"
- target_system_name: "k8"
- target_cpu: "k8"
- target_libc: "local"
- compiler: "clang"
- abi_version: "local"
- abi_libc_version: "local"
- tool_path {
- name: "ar"
- path: "clang_6p0/x86_64-linux-gnu-ar"
- }
- tool_path {
- name: "compat-ld"
- path: "clang_6p0/x86_64-linux-gnu-ld"
- }
- tool_path {
- name: "cpp"
- path: "clang_6p0/x86_64-linux-gnu-cpp"
- }
- tool_path {
- name: "dwp"
- path: "clang_6p0/x86_64-linux-gnu-dwp"
- }
- tool_path {
- name: "gcc"
- path: "clang_6p0/x86_64-linux-gnu-clang-6.0"
- }
- tool_path {
- name: "gcov"
- path: "clang_6p0/x86_64-linux-gnu-gcov"
- }
- tool_path {
- name: "ld"
- path: "clang_6p0/x86_64-linux-gnu-ld"
- }
- tool_path {
- name: "nm"
- path: "clang_6p0/x86_64-linux-gnu-nm"
- }
- tool_path {
- name: "objcopy"
- path: "clang_6p0/x86_64-linux-gnu-objcopy"
- }
- tool_path {
- name: "objdump"
- path: "clang_6p0/x86_64-linux-gnu-objdump"
- }
- tool_path {
- name: "strip"
- path: "clang_6p0/x86_64-linux-gnu-strip"
- }
- supports_gold_linker: false
- supports_thin_archives: false
- needsPic: true
- compiler_flag: "--sysroot=external/amd64_debian_sysroot"
- compiler_flag: "-nostdinc"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/7"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu/c++/7"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/8/backward"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/8/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/clang_6p0_repo/usr/lib/llvm-6.0/lib/clang/6.0.0/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include"
- compiler_flag: "-D__STDC_FORMAT_MACROS"
- compiler_flag: "-D__STDC_CONSTANT_MACROS"
- compiler_flag: "-D__STDC_LIMIT_MACROS"
- compiler_flag: "-D_FILE_OFFSET_BITS=64"
- compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
- compiler_flag: "-U_FORTIFY_SOURCE"
- compiler_flag: "-D_FORTIFY_SOURCE=1"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- compiler_flag: "-fcolor-diagnostics"
- compiler_flag: "-fmessage-length=80"
- compiler_flag: "-fmacro-backtrace-limit=0"
- compiler_flag: "-Wall"
- compiler_flag: "-Wextra"
- compiler_flag: "-Wpointer-arith"
- compiler_flag: "-Wstrict-aliasing"
- compiler_flag: "-Wcast-qual"
- compiler_flag: "-Wcast-align"
- compiler_flag: "-Wwrite-strings"
- compiler_flag: "-Wtype-limits"
- compiler_flag: "-Wsign-compare"
- compiler_flag: "-Wformat=2"
- compiler_flag: "-Werror"
- compiler_flag: "-fno-omit-frame-pointer"
- compiler_flag: "-pipe"
- compiler_flag: "-ggdb3"
- linker_flag: "-nodefaultlibs"
- linker_flag: "--sysroot=external/amd64_debian_sysroot"
- linker_flag: "-lstdc++"
- linker_flag: "-lc"
- linker_flag: "-lgcc"
- linker_flag: "-lgcc_s"
- linker_flag: "-Bexternal/clang_6p0_repo/usr/bin/"
- linker_flag: "-Ltools/cpp/clang_6p0/clang_more_libs"
- linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/7/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/x86_64-linux-gnu/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/lib/x86_64-linux-gnu/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/lib/"
- linker_flag: "-no-canonical-prefixes"
- linker_flag: "-fuse-ld=gold"
- linker_flag: "-Wl,-z,relro,-z,now"
- linker_flag: "-lm"
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- linker_flag: "-Wl,--warn-execstack"
- linker_flag: "-Wl,--detect-odr-violations"
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- compilation_mode_flags {
- mode: OPT
- compiler_flag: "-O2"
- compiler_flag: "-DNDEBUG"
- compiler_flag: "-ffunction-sections"
- compiler_flag: "-fdata-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- linking_mode_flags {
- mode: DYNAMIC
- }
- cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/lib/llvm-6.0/lib/clang/6.0.0/include"
- cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/include"
- cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include"
- cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include-fixed"
- builtin_sysroot: ""
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
- unfiltered_cxx_flag: "-Wno-varargs"
- unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
- unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_interface_shared_objects: false
- supports_incremental_linker: false
- supports_fission: false
- feature {
- name: "opt"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "dbg"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=1"
- }
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "fastbuild"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "-std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-std=gnu++1z"
- }
- }
- }
- feature {
- name: "pie_for_linking"
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- }
- }
- enabled: true
- }
-}
-toolchain {
- toolchain_identifier: "roborio_linux"
- host_system_name: "roborio"
- target_system_name: "roborio"
- target_cpu: "roborio"
- target_libc: "roborio"
- compiler: "gcc"
- abi_version: "roborio"
- abi_libc_version: "roborio"
- tool_path {
- name: "ar"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar"
- }
- tool_path {
- name: "as"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as"
- }
- tool_path {
- name: "compat-ld"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld"
- }
- tool_path {
- name: "cpp"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp"
- }
- tool_path {
- name: "dwp"
- path: "/bin/false"
- }
- tool_path {
- name: "gcc"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc"
- }
- tool_path {
- name: "gcov"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9"
- }
- tool_path {
- name: "ld"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld"
- }
- tool_path {
- name: "nm"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm"
- }
- tool_path {
- name: "objcopy"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy"
- }
- tool_path {
- name: "objdump"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump"
- }
- tool_path {
- name: "strip"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip"
- }
- supports_gold_linker: false
- supports_thin_archives: false
- needsPic: true
- linker_flag: "-lstdc++"
- linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
- linker_flag: "-no-canonical-prefixes"
- linker_flag: "-Wl,-z,relro,-z,now"
- linker_flag: "-lm"
- linker_flag: "-pass-exit-codes"
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- linking_mode_flags {
- mode: DYNAMIC
- }
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include)%"
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed)%"
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%"
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward)%"
- builtin_sysroot: ""
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_interface_shared_objects: false
- supports_incremental_linker: false
- supports_fission: false
- feature {
- name: "compile_flags1"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "c++-module-codegen"
- action: "lto-backend"
- action: "clif-match"
- flag_group {
- flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi"
- flag: "-nostdinc"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed"
- }
- }
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- flag_group {
- flag: "-fno-canonical-system-headers"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "c++-module-codegen"
- flag_group {
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward"
- }
- }
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "c++-module-codegen"
- action: "lto-backend"
- action: "clif-match"
- flag_group {
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include"
- flag: "-mfpu=neon"
- flag: "-D__STDC_FORMAT_MACROS"
- flag: "-D__STDC_CONSTANT_MACROS"
- flag: "-D__STDC_LIMIT_MACROS"
- flag: "-D_FILE_OFFSET_BITS=64"
- flag: "-DAOS_ARCHITECTURE_arm_frc"
- flag: "-U_FORTIFY_SOURCE"
- flag: "-fstack-protector"
- flag: "-fPIE"
- flag: "-fdiagnostics-color=always"
- flag: "-Wall"
- flag: "-Wextra"
- flag: "-Wpointer-arith"
- flag: "-Wstrict-aliasing"
- flag: "-Wcast-qual"
- flag: "-Wwrite-strings"
- flag: "-Wtype-limits"
- flag: "-Wsign-compare"
- flag: "-Wformat=2"
- flag: "-Werror"
- flag: "-Wunused-local-typedefs"
- flag: "-Wno-psabi"
- flag: "-fno-omit-frame-pointer"
- flag: "-D__has_feature(x)=0"
- flag: "-pipe"
- flag: "-ggdb3"
- }
- }
- enabled: true
- }
- feature {
- name: "opt"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-module-compile"
- action: "objc-compile"
- action: "objc++-compile"
- action: "c++-header-parsing"
- action: "linkstamp-compile"
- flag_group {
- flag: "-O2"
- flag: "-DNDEBUG"
- flag: "-D_FORTIFY_SOURCE=1"
- flag: "-ffunction-sections"
- flag: "-fdata-sections"
- }
- }
- flag_set {
- action: "c++-link-executable"
- action: "c++-link-nodeps-dynamic-library"
- action: "c++-link-dynamic-library"
- flag_group {
- flag: "-Wl,--gc-sections"
- }
- }
- implies: "opt_post"
- }
- feature {
- name: "dependency_file"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-module-compile"
- action: "objc-compile"
- action: "objc++-compile"
- action: "c++-header-parsing"
- action: "clif-match"
- flag_group {
- flag: "-MD"
- flag: "-MF"
- flag: "%{dependency_file}"
- }
- expand_if_all_available: "dependency_file"
- }
- }
- feature {
- name: "random_seed"
- flag_set {
- action: "c++-compile"
- action: "c++-module-codegen"
- action: "c++-module-compile"
- flag_group {
- flag: "-frandom-seed=%{output_file}"
- expand_if_all_available: "output_file"
- }
- }
- }
- feature {
- name: "pic"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "linkstamp-compile"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-module-codegen"
- action: "c++-module-compile"
- flag_group {
- flag: "-fPIC"
- }
- expand_if_all_available: "pic"
- }
- }
- feature {
- name: "preprocessor_defines"
- flag_set {
- action: "preprocess-assemble"
- action: "linkstamp-compile"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "clif-match"
- flag_group {
- flag: "-D%{preprocessor_defines}"
- iterate_over: "preprocessor_defines"
- }
- }
- }
- feature {
- name: "include_paths"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-iquote"
- flag: "%{quote_include_paths}"
- iterate_over: "quote_include_paths"
- }
- flag_group {
- flag: "-I%{include_paths}"
- iterate_over: "include_paths"
- }
- flag_group {
- flag: "-isystem"
- flag: "%{system_include_paths}"
- iterate_over: "system_include_paths"
- }
- }
- }
- feature {
- name: "opt_post"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
- feature {
- name: "dbg"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=1"
- }
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- }
- feature {
- name: "fastbuild"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "-std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-std=gnu++1z"
- flag: "-fno-sized-deallocation"
- }
- }
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c++-link"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- action: "c-compile"
- flag_group {
- flag: "-pthread"
- }
- }
- enabled: true
- }
- feature {
- name: "pie_for_linking"
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- }
- }
- enabled: true
- }
-}
-toolchain {
- toolchain_identifier: "clang_linux_armhf"
- host_system_name: "linux"
- target_system_name: "arm_a15"
- target_cpu: "armhf-debian"
- target_libc: "glibc_2.19"
- compiler: "clang"
- abi_version: "clang_6.0"
- abi_libc_version: "glibc_2.19"
- tool_path {
- name: "ar"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-ar"
- }
- tool_path {
- name: "compat-ld"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-ld"
- }
- tool_path {
- name: "cpp"
- path: "linaro_linux_gcc/clang_bin/clang"
- }
- tool_path {
- name: "dwp"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp"
- }
- tool_path {
- name: "gcc"
- path: "linaro_linux_gcc/clang_bin/clang"
- }
- tool_path {
- name: "gcov"
- path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9"
- }
- tool_path {
- name: "ld"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-ld"
- }
- tool_path {
- name: "nm"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-nm"
- }
- tool_path {
- name: "objcopy"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy"
- }
- tool_path {
- name: "objdump"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump"
- }
- tool_path {
- name: "strip"
- path: "linaro_linux_gcc/arm-linux-gnueabihf-strip"
- }
- supports_gold_linker: false
- supports_thin_archives: true
- needsPic: true
- compiler_flag: "-target"
- compiler_flag: "armv7a-arm-linux-gnueabif"
- compiler_flag: "--sysroot=external/armhf_debian_rootfs"
- compiler_flag: "-mfloat-abi=hard"
- compiler_flag: "-mfpu=vfpv3-d16"
- compiler_flag: "-nostdinc"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1"
- compiler_flag: "-isystem"
- compiler_flag: "external/armhf_debian_rootfs/usr/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/armhf_debian_rootfs/usr/include/arm-linux-gnueabihf"
- compiler_flag: "-isystem"
- compiler_flag: "external/org_frc971/third_party"
- compiler_flag: "-D__STDC_FORMAT_MACROS"
- compiler_flag: "-D__STDC_CONSTANT_MACROS"
- compiler_flag: "-D__STDC_LIMIT_MACROS"
- compiler_flag: "-D_FILE_OFFSET_BITS=64"
- compiler_flag: "-DAOS_ARCHITECTURE_armhf"
- compiler_flag: "-U_FORTIFY_SOURCE"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- compiler_flag: "-fdiagnostics-color=always"
- compiler_flag: "-Wall"
- compiler_flag: "-Wextra"
- compiler_flag: "-Wpointer-arith"
- compiler_flag: "-Wstrict-aliasing"
- compiler_flag: "-Wcast-qual"
- compiler_flag: "-Wcast-align"
- compiler_flag: "-Wwrite-strings"
- compiler_flag: "-Wtype-limits"
- compiler_flag: "-Wsign-compare"
- compiler_flag: "-Wformat=2"
- compiler_flag: "-Werror"
- compiler_flag: "-Wunused-local-typedefs"
- compiler_flag: "-fno-omit-frame-pointer"
- compiler_flag: "-pipe"
- compiler_flag: "-ggdb3"
- linker_flag: "-target"
- linker_flag: "armv7a-arm-linux-gnueabif"
- linker_flag: "--sysroot=external/armhf_debian_rootfs"
- linker_flag: "-lstdc++"
- linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
- linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/gcc/arm-linux-gnueabihf/8"
- linker_flag: "-Lexternal/armhf_debian_rootfs/lib/arm-linux-gnueabihf"
- linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/arm-linux-gnueabihf"
- linker_flag: "-Lexternal/armhf_debian_rootfs/lib"
- linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib"
- linker_flag: "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
- linker_flag: "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
- linker_flag: "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin"
- linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
- linker_flag: "-no-canonical-prefixes"
- linker_flag: "-Wl,-z,relro,-z,now"
- linker_flag: "-lm"
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- compilation_mode_flags {
- mode: OPT
- compiler_flag: "-O2"
- compiler_flag: "-DNDEBUG"
- compiler_flag: "-D_FORTIFY_SOURCE=1"
- compiler_flag: "-ffunction-sections"
- compiler_flag: "-fdata-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- linking_mode_flags {
- mode: DYNAMIC
- }
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%"
- cxx_builtin_include_directory: "%package(@armhf_debian_rootfs//usr/include)%"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1"
- builtin_sysroot: ""
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
- unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
- unfiltered_cxx_flag: "-Wno-varargs"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
- supports_normalizing_ar: true
- supports_start_end_lib: false
- supports_interface_shared_objects: false
- supports_incremental_linker: false
- supports_fission: false
- feature {
- name: "opt"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "dbg"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=1"
- }
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "fastbuild"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "-std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-std=gnu++1z"
- }
- }
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c++-link"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- action: "c-compile"
- flag_group {
- flag: "-pthread"
- }
- }
- }
- feature {
- name: "pie_for_linking"
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- }
- }
- enabled: true
- }
-}
-toolchain {
- toolchain_identifier: "cortex-m4f"
- host_system_name: "local"
- target_system_name: "cortex-m4f"
- target_cpu: "cortex-m4f"
- target_libc: "cortex-m4f"
- compiler: "gcc"
- abi_version: "cortex-m4f"
- abi_libc_version: "cortex-m4f"
- tool_path {
- name: "ar"
- path: "gcc_arm_none_eabi/arm-none-eabi-ar"
- }
- tool_path {
- name: "compat-ld"
- path: "gcc_arm_none_eabi/arm-none-eabi-ld"
- }
- tool_path {
- name: "cpp"
- path: "gcc_arm_none_eabi/arm-none-eabi-cpp"
- }
- tool_path {
- name: "dwp"
- path: "gcc_arm_none_eabi/arm-none-eabi-dwp"
- }
- tool_path {
- name: "gcc"
- path: "gcc_arm_none_eabi/arm-none-eabi-gcc"
- }
- tool_path {
- name: "gcov"
- path: "gcc_arm_none_eabi/arm-none-eabi-gcov"
- }
- tool_path {
- name: "ld"
- path: "gcc_arm_none_eabi/arm-none-eabi-ld"
- }
- tool_path {
- name: "nm"
- path: "gcc_arm_none_eabi/arm-none-eabi-nm"
- }
- tool_path {
- name: "objcopy"
- path: "gcc_arm_none_eabi/arm-none-eabi-objcopy"
- }
- tool_path {
- name: "objdump"
- path: "gcc_arm_none_eabi/arm-none-eabi-objdump"
- }
- tool_path {
- name: "strip"
- path: "gcc_arm_none_eabi/arm-none-eabi-strip"
- }
- supports_gold_linker: false
- supports_thin_archives: false
- needsPic: false
- compiler_flag: "-D__STDC_FORMAT_MACROS"
- compiler_flag: "-D__STDC_CONSTANT_MACROS"
- compiler_flag: "-D__STDC_LIMIT_MACROS"
- compiler_flag: "-D__MK64FX512__"
- compiler_flag: "-DF_CPU=120000000"
- compiler_flag: "-Wl,--gc-sections"
- compiler_flag: "-D__have_long32"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-mcpu=cortex-m4"
- compiler_flag: "-mfpu=fpv4-sp-d16"
- compiler_flag: "-mthumb"
- compiler_flag: "-mfloat-abi=hard"
- compiler_flag: "-fno-strict-aliasing"
- compiler_flag: "-fmessage-length=80"
- compiler_flag: "-fmax-errors=20"
- compiler_flag: "-Wall"
- compiler_flag: "-Wextra"
- compiler_flag: "-Wpointer-arith"
- compiler_flag: "-Wcast-qual"
- compiler_flag: "-Wwrite-strings"
- compiler_flag: "-Wtype-limits"
- compiler_flag: "-Wsign-compare"
- compiler_flag: "-Wformat=2"
- compiler_flag: "-Werror"
- compiler_flag: "-Wstrict-aliasing=2"
- compiler_flag: "-Wno-misleading-indentation"
- compiler_flag: "-Wno-int-in-bool-context"
- compiler_flag: "-Wdouble-promotion"
- compiler_flag: "-pipe"
- compiler_flag: "-g"
- compiler_flag: "-fno-common"
- compiler_flag: "-ffreestanding"
- compiler_flag: "-fbuiltin"
- linker_flag: "-no-canonical-prefixes"
- linker_flag: "-mcpu=cortex-m4"
- linker_flag: "-mfpu=fpv4-sp-d16"
- linker_flag: "-mthumb"
- linker_flag: "-mfloat-abi=hard"
- linker_flag: "-fno-strict-aliasing"
- linker_flag: "--specs=nano.specs"
- linker_flag: "-lgcc"
- linker_flag: "-lstdc++_nano"
- linker_flag: "-lm"
- linker_flag: "-lc_nano"
- linker_flag: "-Tmotors/core/kinetis_512_256.ld"
- linker_flag: "-Tmotors/core/kinetis_sections.ld"
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- compilation_mode_flags {
- mode: OPT
- compiler_flag: "-O2"
- compiler_flag: "-finline-functions"
- compiler_flag: "-ffast-math"
- compiler_flag: "-funroll-loops"
- compiler_flag: "-DNDEBUG"
- compiler_flag: "-ffunction-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- linking_mode_flags {
- mode: FULLY_STATIC
- }
- cxx_builtin_include_directory: "/usr/lib/gcc/arm-none-eabi/4.8/include"
- cxx_builtin_include_directory: "/usr/lib/gcc/arm-none-eabi/4.8/include-fixed"
- cxx_builtin_include_directory: "/usr/lib/arm-none-eabi/include"
- cxx_builtin_include_directory: "/usr/include/newlib"
- builtin_sysroot: ""
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_interface_shared_objects: false
- supports_incremental_linker: false
- supports_fission: false
- feature {
- name: "dbg"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "opt"
- implies: "all_modes"
- }
- feature {
- name: "fastbuild"
- implies: "all_modes"
- }
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "--std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "--std=gnu++1z"
- flag: "-fno-exceptions"
- flag: "-fno-rtti"
- }
- }
- }
- feature {
- name: "include_paths"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-iquote"
- flag: "%{quote_include_paths}"
- iterate_over: "quote_include_paths"
- }
- flag_group {
- flag: "-I%{include_paths}"
- iterate_over: "include_paths"
- }
- flag_group {
- flag: "-I"
- flag: "%{system_include_paths}"
- iterate_over: "system_include_paths"
- }
- }
- }
-}
-toolchain {
- toolchain_identifier: "cortex-m4f-k22"
- host_system_name: "local"
- target_system_name: "cortex-m4f-k22"
- target_cpu: "cortex-m4f-k22"
- target_libc: "cortex-m4f-k22"
- compiler: "gcc"
- abi_version: "cortex-m4f-k22"
- abi_libc_version: "cortex-m4f-k22"
- tool_path {
- name: "ar"
- path: "gcc_arm_none_eabi/arm-none-eabi-ar"
- }
- tool_path {
- name: "compat-ld"
- path: "gcc_arm_none_eabi/arm-none-eabi-ld"
- }
- tool_path {
- name: "cpp"
- path: "gcc_arm_none_eabi/arm-none-eabi-cpp"
- }
- tool_path {
- name: "dwp"
- path: "gcc_arm_none_eabi/arm-none-eabi-dwp"
- }
- tool_path {
- name: "gcc"
- path: "gcc_arm_none_eabi/arm-none-eabi-gcc"
- }
- tool_path {
- name: "gcov"
- path: "gcc_arm_none_eabi/arm-none-eabi-gcov"
- }
- tool_path {
- name: "ld"
- path: "gcc_arm_none_eabi/arm-none-eabi-ld"
- }
- tool_path {
- name: "nm"
- path: "gcc_arm_none_eabi/arm-none-eabi-nm"
- }
- tool_path {
- name: "objcopy"
- path: "gcc_arm_none_eabi/arm-none-eabi-objcopy"
- }
- tool_path {
- name: "objdump"
- path: "gcc_arm_none_eabi/arm-none-eabi-objdump"
- }
- tool_path {
- name: "strip"
- path: "gcc_arm_none_eabi/arm-none-eabi-strip"
- }
- supports_gold_linker: false
- supports_thin_archives: false
- needsPic: false
- compiler_flag: "-D__STDC_FORMAT_MACROS"
- compiler_flag: "-D__STDC_CONSTANT_MACROS"
- compiler_flag: "-D__STDC_LIMIT_MACROS"
- compiler_flag: "-D__MK22FX512__"
- compiler_flag: "-DF_CPU=120000000"
- compiler_flag: "-Wl,--gc-sections"
- compiler_flag: "-D__have_long32"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-mcpu=cortex-m4"
- compiler_flag: "-mfpu=fpv4-sp-d16"
- compiler_flag: "-mthumb"
- compiler_flag: "-mfloat-abi=hard"
- compiler_flag: "-fno-strict-aliasing"
- compiler_flag: "-fmessage-length=80"
- compiler_flag: "-fmax-errors=20"
- compiler_flag: "-Wall"
- compiler_flag: "-Wextra"
- compiler_flag: "-Wpointer-arith"
- compiler_flag: "-Wcast-qual"
- compiler_flag: "-Wwrite-strings"
- compiler_flag: "-Wtype-limits"
- compiler_flag: "-Wsign-compare"
- compiler_flag: "-Wformat=2"
- compiler_flag: "-Werror"
- compiler_flag: "-Wstrict-aliasing=2"
- compiler_flag: "-Wno-misleading-indentation"
- compiler_flag: "-Wno-int-in-bool-context"
- compiler_flag: "-Wdouble-promotion"
- compiler_flag: "-pipe"
- compiler_flag: "-g"
- compiler_flag: "-fno-common"
- compiler_flag: "-ffreestanding"
- compiler_flag: "-fbuiltin"
- linker_flag: "-no-canonical-prefixes"
- linker_flag: "-mcpu=cortex-m4"
- linker_flag: "-mfpu=fpv4-sp-d16"
- linker_flag: "-mthumb"
- linker_flag: "-mfloat-abi=hard"
- linker_flag: "-fno-strict-aliasing"
- linker_flag: "--specs=nano.specs"
- linker_flag: "-lgcc"
- linker_flag: "-lstdc++_nano"
- linker_flag: "-lm"
- linker_flag: "-lc_nano"
- linker_flag: "-Tmotors/core/kinetis_512_128.ld"
- linker_flag: "-Tmotors/core/kinetis_sections.ld"
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- compilation_mode_flags {
- mode: OPT
- compiler_flag: "-O2"
- compiler_flag: "-finline-functions"
- compiler_flag: "-ffast-math"
- compiler_flag: "-funroll-loops"
- compiler_flag: "-DNDEBUG"
- compiler_flag: "-ffunction-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- linking_mode_flags {
- mode: FULLY_STATIC
- }
- cxx_builtin_include_directory: "/usr/lib/gcc/arm-none-eabi/4.8/include"
- cxx_builtin_include_directory: "/usr/lib/gcc/arm-none-eabi/4.8/include-fixed"
- cxx_builtin_include_directory: "/usr/lib/arm-none-eabi/include"
- cxx_builtin_include_directory: "/usr/include/newlib"
- builtin_sysroot: ""
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_interface_shared_objects: false
- supports_incremental_linker: false
- supports_fission: false
- feature {
- name: "dbg"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- implies: "all_modes"
- }
- feature {
- name: "opt"
- implies: "all_modes"
- }
- feature {
- name: "fastbuild"
- implies: "all_modes"
- }
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "--std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "--std=gnu++1z"
- flag: "-fno-exceptions"
- flag: "-fno-rtti"
- }
- }
- }
- feature {
- name: "include_paths"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-iquote"
- flag: "%{quote_include_paths}"
- iterate_over: "quote_include_paths"
- }
- flag_group {
- flag: "-I%{include_paths}"
- iterate_over: "include_paths"
- }
- flag_group {
- flag: "-I"
- flag: "%{system_include_paths}"
- iterate_over: "system_include_paths"
- }
- }
- }
-}
diff --git a/tools/cpp/gen_crosstool.py b/tools/cpp/gen_crosstool.py
deleted file mode 100644
index ec70e11..0000000
--- a/tools/cpp/gen_crosstool.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python3
-
-# Usage: gen_crosstool <base> <cortex_m4f> <output>
-# Example: bazel run //tools/cpp:gen_crosstool $(readlink -f tools/cpp/static_crosstool.pb) $(readlink -f tools/cpp/cortex_m4f_crosstool.pb) $(readlink -f tools/cpp/CROSSTOOL)
-
-import sys
-
-from third_party.bazel.protos import crosstool_config_pb2
-from google.protobuf import text_format
-from google.protobuf.descriptor import FieldDescriptor
-
-def process_string(string, substitutions):
- for a, b in substitutions.items():
- string = string.replace(a, b)
- return string
-
-def rename_message_contents(proto, substitutions):
- for descriptor, value in proto.ListFields():
- if descriptor.type == FieldDescriptor.TYPE_STRING:
- if descriptor.label == FieldDescriptor.LABEL_REPEATED:
- new_value = []
- for string in value:
- new_value.append(process_string(string, substitutions))
- value[:] = new_value
- else:
- setattr(proto, descriptor.name, process_string(value, substitutions))
- if descriptor.type == FieldDescriptor.TYPE_MESSAGE:
- if descriptor.label == FieldDescriptor.LABEL_REPEATED:
- for sub_proto in value:
- rename_message_contents(sub_proto, substitutions)
- else:
- rename_message_contents(value, substitutions)
-
-def add_m4f_toolchain(new_toolchain, m4f_proto, substitutions):
- new_toolchain.CopyFrom(m4f_proto.toolchain[0])
- rename_message_contents(new_toolchain, substitutions)
-
-def main(args):
- crosstool_proto = crosstool_config_pb2.CrosstoolRelease()
- with open(args[0], 'r') as f:
- text_format.Merge(f.read(), crosstool_proto)
-
- m4f_proto = crosstool_config_pb2.CrosstoolRelease()
- with open(args[1], 'r') as f:
- text_format.Merge(f.read(), m4f_proto)
- add_m4f_toolchain(crosstool_proto.toolchain.add(), m4f_proto, {
- '%NAME%': 'cortex-m4f',
- '%CPU%': '__MK64FX512__',
- '%F_CPU%': '120000000',
- '%LINKER_SCRIPT%': 'motors/core/kinetis_512_256.ld',
- })
- # TODO(Brian): The parts we actually use have 1M of FLASH. Do we want to take
- # advantage, or maintain compatibility with alternative parts that use some
- # of it for EEPROM/FlexMem/etc?
- add_m4f_toolchain(crosstool_proto.toolchain.add(), m4f_proto, {
- '%NAME%': 'cortex-m4f-k22',
- '%CPU%': '__MK22FX512__',
- '%F_CPU%': '120000000',
- '%LINKER_SCRIPT%': 'motors/core/kinetis_512_128.ld',
- })
-
- with open(args[2], 'w') as f:
- f.write('# GENERATED FILE. DO NOT EDIT\n')
- f.write('# Generated by tools/cpp/gen_crosstool.py\n')
- f.write(text_format.MessageToString(crosstool_proto))
-
-if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
diff --git a/tools/cpp/static_crosstool.pb b/tools/cpp/static_crosstool.pb
deleted file mode 100644
index dc650d9..0000000
--- a/tools/cpp/static_crosstool.pb
+++ /dev/null
@@ -1,997 +0,0 @@
-major_version: "local"
-minor_version: ""
-default_target_cpu: "same_as_host"
-
-default_toolchain {
- cpu: "roborio"
- toolchain_identifier: "roborio_linux"
-}
-
-default_toolchain {
- cpu: "k8"
- toolchain_identifier: "k8_linux"
-}
-
-default_toolchain {
- cpu: "armeabi-v7a"
- toolchain_identifier: "stub_armeabi-v7a"
-}
-
-default_toolchain {
- cpu: "armhf-debian"
- toolchain_identifier: "clang_linux_armhf"
-}
-
-default_toolchain {
- cpu: "cortex-m4f"
- toolchain_identifier: "cortex-m4f"
-}
-
-default_toolchain {
- cpu: "cortex-m4f-k22"
- toolchain_identifier: "cortex-m4f-k22"
-}
-
-toolchain {
- toolchain_identifier: "stub_armeabi-v7a"
- abi_version: "armeabi-v7a"
- abi_libc_version: "armeabi-v7a"
- builtin_sysroot: ""
- compiler: "compiler"
- host_system_name: "armeabi-v7a"
- needsPic: true
- supports_gold_linker: false
- supports_incremental_linker: false
- supports_fission: false
- supports_interface_shared_objects: false
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_thin_archives: false
- target_libc: "armeabi-v7a"
- target_cpu: "armeabi-v7a"
- target_system_name: "armeabi-v7a"
-
- tool_path { name: "ar" path: "/bin/false" }
- tool_path { name: "compat-ld" path: "/bin/false" }
- tool_path { name: "cpp" path: "/bin/false" }
- tool_path { name: "dwp" path: "/bin/false" }
- tool_path { name: "gcc" path: "/bin/false" }
- tool_path { name: "gcov" path: "/bin/false" }
- tool_path { name: "ld" path: "/bin/false" }
-
- tool_path { name: "nm" path: "/bin/false" }
- tool_path { name: "objcopy" path: "/bin/false" }
- tool_path { name: "objdump" path: "/bin/false" }
- tool_path { name: "strip" path: "/bin/false" }
-}
-
-toolchain {
- abi_version: "local"
- abi_libc_version: "local"
- builtin_sysroot: ""
- compiler: "clang"
- host_system_name: "local"
- needsPic: true
- supports_gold_linker: false
- supports_incremental_linker: false
- supports_fission: false
- supports_interface_shared_objects: false
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_thin_archives: false
- target_libc: "local"
- target_cpu: "k8"
- target_system_name: "k8"
- toolchain_identifier: "k8_linux"
-
- # These paths are relative to //tools/cpp.
- tool_path { name: "ar" path: "clang_6p0/x86_64-linux-gnu-ar" }
- tool_path { name: "compat-ld" path: "clang_6p0/x86_64-linux-gnu-ld" }
- tool_path { name: "cpp" path: "clang_6p0/x86_64-linux-gnu-cpp" }
- tool_path { name: "dwp" path: "clang_6p0/x86_64-linux-gnu-dwp" }
- tool_path { name: "gcc" path: "clang_6p0/x86_64-linux-gnu-clang-6.0" }
- tool_path { name: "gcov" path: "clang_6p0/x86_64-linux-gnu-gcov" }
- # C(++) compiles invoke the compiler (as that is the one knowing where
- # to find libraries), but we provide LD so other rules can invoke the linker.
- tool_path { name: "ld" path: "clang_6p0/x86_64-linux-gnu-ld" }
- tool_path { name: "nm" path: "clang_6p0/x86_64-linux-gnu-nm" }
- tool_path { name: "objcopy" path: "clang_6p0/x86_64-linux-gnu-objcopy" }
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- tool_path { name: "objdump" path: "clang_6p0/x86_64-linux-gnu-objdump" }
- tool_path { name: "strip" path: "clang_6p0/x86_64-linux-gnu-strip" }
- linking_mode_flags { mode: DYNAMIC }
-
- compiler_flag: "--sysroot=external/amd64_debian_sysroot"
- compiler_flag: "-nostdinc"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/7"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu/c++/7"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/c++/8/backward"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/8/include"
- # We don't have anything in /usr/local/include, so don't include it here where
- # would normally go on the default search path.
- compiler_flag: "-isystem"
- compiler_flag: "external/clang_6p0_repo/usr/lib/llvm-6.0/lib/clang/6.0.0/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu"
- compiler_flag: "-isystem"
- compiler_flag: "external/amd64_debian_sysroot/usr/include"
-
- cxx_builtin_include_directory: "%package(@clang_6p0_repo//usr)%/lib/llvm-6.0/lib/clang/6.0.0/include"
- cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/include"
- cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include"
- cxx_builtin_include_directory: "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include-fixed"
-
- linker_flag: "-nodefaultlibs"
- linker_flag: "--sysroot=external/amd64_debian_sysroot"
- linker_flag: "-lstdc++"
- linker_flag: "-lc"
- linker_flag: "-lgcc"
- linker_flag: "-lgcc_s"
- linker_flag: "-Bexternal/clang_6p0_repo/usr/bin/"
- linker_flag: "-Ltools/cpp/clang_6p0/clang_more_libs"
- linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/7/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/x86_64-linux-gnu/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/usr/lib/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/lib/x86_64-linux-gnu/"
- linker_flag: "-Lexternal/amd64_debian_sysroot/lib/"
-
- feature {
- name: "opt"
- implies: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
-
- feature {
- name: "dbg"
- implies: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=1"
- }
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- }
-
- feature {
- name: "fastbuild"
- implies: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
-
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "-std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-std=gnu++1z"
- }
- }
- }
-
- # Anticipated future default.
- # This makes GCC and Clang do what we want when called through symlinks.
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- linker_flag: "-no-canonical-prefixes"
-
- # Things that the code wants defined.
- compiler_flag: "-D__STDC_FORMAT_MACROS"
- compiler_flag: "-D__STDC_CONSTANT_MACROS"
- compiler_flag: "-D__STDC_LIMIT_MACROS"
- compiler_flag: "-D_FILE_OFFSET_BITS=64"
- # TODO(Brian): Rename this or something.
- compiler_flag: "-DAOS_ARCHITECTURE_arm_frc"
-
- linker_flag: "-fuse-ld=gold"
-
- # Make C++ compilation deterministic. Use linkstamping instead of these
- # compiler symbols.
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
-
- # C++17 libraries that tend to cause issues in some libraries that we include.
- unfiltered_cxx_flag: "-Wno-varargs"
- unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
- # The mismatched-new-delete seems to be a bit overly strict currently
- # and errors on:
- # char *p = new char;
- # delete p;
- # p = new char[100];
- # delete[] p;
- unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
-
- # Security hardening on by default.
- # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
- # We need to undef it before redefining it as some distributions now have
- # it enabled by default.
- compiler_flag: "-U_FORTIFY_SOURCE"
- compiler_flag: "-D_FORTIFY_SOURCE=1"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- linker_flag: "-Wl,-z,relro,-z,now"
-
- # Pretty much everything needs this, including parts of the glibc STL...
- linker_flag: "-lm"
-
- # Enable coloring even if there's no attached terminal. Bazel removes the
- # escape sequences if --nocolor is specified.
- compiler_flag: "-fcolor-diagnostics"
- compiler_flag: "-fmessage-length=80"
- compiler_flag: "-fmacro-backtrace-limit=0"
-
- compiler_flag: "-Wall"
- compiler_flag: "-Wextra"
- compiler_flag: "-Wpointer-arith"
- compiler_flag: "-Wstrict-aliasing"
- compiler_flag: "-Wcast-qual"
- compiler_flag: "-Wcast-align"
- compiler_flag: "-Wwrite-strings"
- compiler_flag: "-Wtype-limits"
- compiler_flag: "-Wsign-compare"
- compiler_flag: "-Wformat=2"
- compiler_flag: "-Werror"
-
- # Keep stack frames for debugging, even in opt mode.
- compiler_flag: "-fno-omit-frame-pointer"
-
- # Don't use temp files while compiling.
- compiler_flag: "-pipe"
-
- # Stamp the binary with a unique identifier.
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- linker_flag: "-Wl,--warn-execstack"
- linker_flag: "-Wl,--detect-odr-violations"
-
- # Enable debug symbols.
- compiler_flag: "-ggdb3"
-
- compilation_mode_flags {
- mode: OPT
-
- compiler_flag: "-O2"
-
- # Disable assertions
- compiler_flag: "-DNDEBUG"
-
- # Removal of unused code and data at link time (can this increase binary size in some cases?).
- compiler_flag: "-ffunction-sections"
- compiler_flag: "-fdata-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- feature {
- name: "pie_for_linking"
- enabled: true
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- }
- }
- }
-}
-
-toolchain {
- toolchain_identifier: "roborio_linux"
- host_system_name: "roborio"
- target_system_name: "roborio"
- target_cpu: "roborio"
- target_libc: "roborio"
- compiler: "gcc"
- abi_version: "roborio"
- abi_libc_version: "roborio"
-
- builtin_sysroot: ""
- needsPic: true
- supports_gold_linker: false
- supports_incremental_linker: false
- supports_fission: false
- supports_interface_shared_objects: false
- supports_normalizing_ar: false
- supports_start_end_lib: false
- supports_thin_archives: false
-
- tool_path { name: "ar" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar" }
- tool_path { name: "as" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as" }
- tool_path { name: "compat-ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
- tool_path { name: "cpp" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp" }
- tool_path { name: "dwp" path: "/bin/false" }
- tool_path { name: "gcc" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc" }
- tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
- # C(++) compiles invoke the compiler (as that is the one knowing where
- # to find libraries), but we provide LD so other rules can invoke the linker.
- tool_path { name: "ld" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld" }
- tool_path { name: "nm" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm" }
- tool_path { name: "objcopy" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy" }
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- tool_path { name: "objdump" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump" }
- tool_path { name: "strip" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip" }
- linking_mode_flags { mode: DYNAMIC }
-
- feature {
- name: "compile_flags1"
- enabled: true
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "c++-module-codegen"
- action: "lto-backend"
- action: "clif-match"
- flag_group {
- flag: "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi"
- flag: "-nostdinc"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed"
- }
- }
-
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- flag_group {
- flag: "-fno-canonical-system-headers"
- }
- }
-
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "c++-module-codegen"
- flag_group {
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi"
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward"
- }
- }
-
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "c++-module-codegen"
- action: "lto-backend"
- action: "clif-match"
- flag_group {
- flag: "-isystem"
- flag: "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include"
-
- flag: "-mfpu=neon"
-
- # Things that the code wants defined.
- flag: "-D__STDC_FORMAT_MACROS"
- flag: "-D__STDC_CONSTANT_MACROS"
- flag: "-D__STDC_LIMIT_MACROS"
- flag: "-D_FILE_OFFSET_BITS=64"
-
- # TODO(Brian): Rename this or something.
- flag: "-DAOS_ARCHITECTURE_arm_frc"
-
- # Security hardening on by default.
- # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
- # We need to undef it before redefining it as some distributions now have
- # it enabled by default.
- flag: "-U_FORTIFY_SOURCE"
- flag: "-fstack-protector"
- flag: "-fPIE"
-
- # Enable coloring even if there's no attached terminal. Bazel removes the
- # escape sequences if --nocolor is specified.
- flag: "-fdiagnostics-color=always"
-
- flag: "-Wall"
- flag: "-Wextra"
- flag: "-Wpointer-arith"
- flag: "-Wstrict-aliasing"
- flag: "-Wcast-qual"
- flag: "-Wwrite-strings"
- flag: "-Wtype-limits"
- flag: "-Wsign-compare"
- flag: "-Wformat=2"
- flag: "-Werror"
- flag: "-Wunused-local-typedefs"
- # We don't use libraries compiled with the broken version.
- flag: "-Wno-psabi"
-
- # Keep stack frames for debugging, even in opt mode.
- flag: "-fno-omit-frame-pointer"
-
- flag: "-D__has_feature(x)=0"
-
- # Don't use temp files while compiling.
- flag: "-pipe"
-
- # Enable debug symbols.
- flag: "-ggdb3"
- }
- }
- }
-
- feature {
- name: "opt"
- implies: "opt_post"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-module-compile"
- action: "objc-compile"
- action: "objc++-compile"
- action: "c++-header-parsing"
- action: "linkstamp-compile"
- flag_group {
- flag: "-O2"
- flag: "-DNDEBUG"
- flag: "-D_FORTIFY_SOURCE=1"
- flag: "-ffunction-sections"
- flag: "-fdata-sections"
- }
- }
- flag_set {
- action: "c++-link-executable"
- action: "c++-link-nodeps-dynamic-library"
- action: "c++-link-dynamic-library"
- flag_group {
- flag: "-Wl,--gc-sections"
- }
- }
- }
-
- # TODO(bazel-team): In theory, the path here ought to exactly match the path
- # used by gcc. That works because bazel currently doesn't track files at
- # absolute locations and has no remote execution, yet. However, this will need
- # to be fixed, maybe with auto-detection?
-
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include)%"
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed)%"
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%"
- cxx_builtin_include_directory: "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward)%"
-
- linker_flag: "-lstdc++"
- linker_flag: "-Ltools/cpp/arm-frc-linux-gnueabi/libs"
-
- feature {
- name: "dependency_file"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-module-compile"
- action: "objc-compile"
- action: "objc++-compile"
- action: "c++-header-parsing"
- action: "clif-match"
- expand_if_all_available: "dependency_file"
- flag_group {
- flag: "-MD"
- flag: "-MF"
- flag: "%{dependency_file}"
- }
- }
- }
-
- feature {
- name: "random_seed"
- flag_set {
- # TODO(austin): Should these also have -frandom-seed set? Upstream
- # doesn't.
- # action: "linkstamp-compile"
- # action: "c-compile"
- action: "c++-compile"
- action: "c++-module-codegen"
- action: "c++-module-compile"
- flag_group {
- expand_if_all_available: "output_file"
- flag: "-frandom-seed=%{output_file}"
- }
- }
- }
-
- feature {
- name: "pic"
- flag_set {
- action: "assemble"
- action: "preprocess-assemble"
- action: "linkstamp-compile"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-module-codegen"
- action: "c++-module-compile"
- expand_if_all_available: "pic"
- flag_group {
- flag: "-fPIC"
- }
- }
- }
-
- feature {
- name: "preprocessor_defines"
- flag_set {
- action: "preprocess-assemble"
- action: "linkstamp-compile"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-module-compile"
- action: "clif-match"
- flag_group {
- iterate_over: "preprocessor_defines"
- flag: "-D%{preprocessor_defines}"
- }
- }
- }
-
- feature {
- name: "include_paths"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-iquote"
- flag: "%{quote_include_paths}"
- iterate_over: "quote_include_paths"
- }
- flag_group {
- flag: "-I%{include_paths}"
- iterate_over: "include_paths"
- }
- flag_group {
- flag: "-isystem"
- flag: "%{system_include_paths}"
- iterate_over: "system_include_paths"
- }
- }
- }
-
- feature {
- name: "opt_post"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
-
- feature {
- name: "dbg"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=1"
- }
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- }
-
- feature {
- name: "fastbuild"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
-
- feature {
- name: "all_modes"
- enabled: true
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "-std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-std=gnu++1z"
- flag: "-fno-sized-deallocation"
- }
- }
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c++-link"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- action: "c-compile"
- flag_group {
- # We always want to compile with -pthread semantics.
- flag: "-pthread"
- }
- }
- }
-
- # Anticipated future default.
- # This makes GCC and Clang do what we want when called through symlinks.
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- linker_flag: "-no-canonical-prefixes"
-
- # Make C++ compilation deterministic. Use linkstamping instead of these
- # compiler symbols.
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
-
- linker_flag: "-Wl,-z,relro,-z,now"
-
- # Pretty much everything needs this, including parts of the glibc STL...
- linker_flag: "-lm"
-
- # Have GCC return the exit code from ld.
- linker_flag: "-pass-exit-codes"
-
- # Stamp the binary with a unique identifier.
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- #linker_flag: "-Wl,--warn-execstack"
- #linker_flag: "-Wl,--detect-odr-violations"
-
- feature {
- name: "pie_for_linking"
- enabled: true
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- }
- }
- }
-}
-
-toolchain {
- abi_version: "clang_6.0"
- abi_libc_version: "glibc_2.19"
- builtin_sysroot: ""
- compiler: "clang"
- host_system_name: "linux"
- needsPic: true
- supports_gold_linker: false
- supports_incremental_linker: false
- supports_fission: false
- supports_interface_shared_objects: false
- supports_normalizing_ar: true
- supports_start_end_lib: false
- supports_thin_archives: true
- target_libc: "glibc_2.19"
- target_cpu: "armhf-debian"
- target_system_name: "arm_a15"
- toolchain_identifier: "clang_linux_armhf"
-
- tool_path { name: "ar" path: "linaro_linux_gcc/arm-linux-gnueabihf-ar" }
- tool_path { name: "compat-ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
- tool_path { name: "cpp" path: "linaro_linux_gcc/clang_bin/clang" }
- tool_path { name: "dwp" path: "linaro_linux_gcc/arm-linux-gnueabihf-dwp" }
- tool_path { name: "gcc" path: "linaro_linux_gcc/clang_bin/clang" }
- tool_path { name: "gcov" path: "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9" }
- # C(++) compiles invoke the compiler (as that is the one knowing where
- # to find libraries), but we provide LD so other rules can invoke the linker.
- tool_path { name: "ld" path: "linaro_linux_gcc/arm-linux-gnueabihf-ld" }
- tool_path { name: "nm" path: "linaro_linux_gcc/arm-linux-gnueabihf-nm" }
- tool_path { name: "objcopy" path: "linaro_linux_gcc/arm-linux-gnueabihf-objcopy" }
- objcopy_embed_flag: "-I"
- objcopy_embed_flag: "binary"
- tool_path { name: "objdump" path: "linaro_linux_gcc/arm-linux-gnueabihf-objdump" }
- tool_path { name: "strip" path: "linaro_linux_gcc/arm-linux-gnueabihf-strip" }
- linking_mode_flags { mode: DYNAMIC }
-
- compiler_flag: "-target"
- compiler_flag: "armv7a-arm-linux-gnueabif"
- compiler_flag: "--sysroot=external/armhf_debian_rootfs"
- compiler_flag: "-mfloat-abi=hard"
- compiler_flag: "-mfpu=vfpv3-d16"
-
- compiler_flag: "-nostdinc"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf"
- compiler_flag: "-isystem"
- compiler_flag: "external/linaro_linux_gcc_repo/include/c++/7.4.1"
- compiler_flag: "-isystem"
- compiler_flag: "external/armhf_debian_rootfs/usr/include"
- compiler_flag: "-isystem"
- compiler_flag: "external/armhf_debian_rootfs/usr/include/arm-linux-gnueabihf"
- compiler_flag: "-isystem"
- compiler_flag: "external/org_frc971/third_party"
-
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%"
- cxx_builtin_include_directory: "%package(@armhf_debian_rootfs//usr/include)%"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%"
- cxx_builtin_include_directory: "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1"
-
- linker_flag: "-target"
- linker_flag: "armv7a-arm-linux-gnueabif"
- linker_flag: "--sysroot=external/armhf_debian_rootfs"
- linker_flag: "-lstdc++"
- linker_flag: "-Ltools/cpp/linaro_linux_gcc/clang_more_libs"
- linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/gcc/arm-linux-gnueabihf/8"
- linker_flag: "-Lexternal/armhf_debian_rootfs/lib/arm-linux-gnueabihf"
- linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib/arm-linux-gnueabihf"
- linker_flag: "-Lexternal/armhf_debian_rootfs/lib"
- linker_flag: "-Lexternal/armhf_debian_rootfs/usr/lib"
- linker_flag: "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
- linker_flag: "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1"
- linker_flag: "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin"
- linker_flag: "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"
-
- feature {
- name: "opt"
- implies: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
-
- feature {
- name: "dbg"
- implies: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=1"
- }
- flag_group {
- flag: "-fno-omit-frame-pointer"
- }
- }
- }
-
- feature {
- name: "fastbuild"
- implies: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "c-compile"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-DAOS_DEBUG=0"
- }
- }
- }
-
- feature {
- name: "all_modes"
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c-compile"
- flag_group {
- flag: "-std=gnu99"
- }
- }
- flag_set {
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- flag_group {
- flag: "-std=gnu++1z"
- }
- }
- flag_set {
- action: "preprocess-assemble"
- action: "assemble"
- action: "c++-link"
- action: "c++-compile"
- action: "c++-header-parsing"
- action: "c++-header-preprocessing"
- action: "c++-module-compile"
- action: "c-compile"
- flag_group {
- # We always want to compile with -pthread semantics.
- flag: "-pthread"
- }
- }
- }
-
- # Anticipated future default.
- # This makes GCC and Clang do what we want when called through symlinks.
- unfiltered_cxx_flag: "-no-canonical-prefixes"
- linker_flag: "-no-canonical-prefixes"
-
- # Things that the code wants defined.
- compiler_flag: "-D__STDC_FORMAT_MACROS"
- compiler_flag: "-D__STDC_CONSTANT_MACROS"
- compiler_flag: "-D__STDC_LIMIT_MACROS"
- compiler_flag: "-D_FILE_OFFSET_BITS=64"
- # TODO(Brian): Rename this or something.
- compiler_flag: "-DAOS_ARCHITECTURE_armhf"
-
- # Make C++ compilation deterministic. Use linkstamping instead of these
- # compiler symbols.
- unfiltered_cxx_flag: "-Wno-builtin-macro-redefined"
- unfiltered_cxx_flag: "-Wno-mismatched-new-delete"
- unfiltered_cxx_flag: "-Wno-null-pointer-arithmetic"
- unfiltered_cxx_flag: "-Wno-varargs"
- unfiltered_cxx_flag: "-D__DATE__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIMESTAMP__=\"redacted\""
- unfiltered_cxx_flag: "-D__TIME__=\"redacted\""
-
- # Security hardening on by default.
- # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
- # We need to undef it before redefining it as some distributions now have
- # it enabled by default.
- compiler_flag: "-U_FORTIFY_SOURCE"
- compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- linker_flag: "-Wl,-z,relro,-z,now"
-
- # Pretty much everything needs this, including parts of the glibc STL...
- linker_flag: "-lm"
-
- # Enable coloring even if there's no attached terminal. Bazel removes the
- # escape sequences if --nocolor is specified.
- compiler_flag: "-fdiagnostics-color=always"
-
- compiler_flag: "-Wall"
- compiler_flag: "-Wextra"
- compiler_flag: "-Wpointer-arith"
- compiler_flag: "-Wstrict-aliasing"
- compiler_flag: "-Wcast-qual"
- compiler_flag: "-Wcast-align"
- compiler_flag: "-Wwrite-strings"
- compiler_flag: "-Wtype-limits"
- compiler_flag: "-Wsign-compare"
- compiler_flag: "-Wformat=2"
- compiler_flag: "-Werror"
- compiler_flag: "-Wunused-local-typedefs"
-
- # Keep stack frames for debugging, even in opt mode.
- compiler_flag: "-fno-omit-frame-pointer"
-
- # Don't use temp files while compiling.
- compiler_flag: "-pipe"
-
- # Stamp the binary with a unique identifier.
- linker_flag: "-Wl,--build-id=md5"
- linker_flag: "-Wl,--hash-style=gnu"
- #linker_flag: "-Wl,--warn-execstack"
- #linker_flag: "-Wl,--detect-odr-violations"
-
- # Enable debug symbols.
- compiler_flag: "-ggdb3"
-
- compilation_mode_flags {
- mode: OPT
-
- compiler_flag: "-O2"
-
- # Disable assertions
- compiler_flag: "-DNDEBUG"
- compiler_flag: "-D_FORTIFY_SOURCE=1"
-
- # Removal of unused code and data at link time (can this increase binary size in some cases?).
- compiler_flag: "-ffunction-sections"
- compiler_flag: "-fdata-sections"
- linker_flag: "-Wl,--gc-sections"
- }
- feature {
- name: "pie_for_linking"
- enabled: true
- flag_set {
- action: "c++-link-executable"
- flag_group {
- flag: "-pie"
- }
- }
- }
-}
diff --git a/tools/cpp/toolchain_config.bzl b/tools/cpp/toolchain_config.bzl
new file mode 100644
index 0000000..8804cd2
--- /dev/null
+++ b/tools/cpp/toolchain_config.bzl
@@ -0,0 +1,1869 @@
+load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
+ "action_config",
+ "artifact_name_pattern",
+ "env_entry",
+ "env_set",
+ "feature",
+ "feature_set",
+ "flag_group",
+ "flag_set",
+ "make_variable",
+ "tool",
+ "tool_path",
+ "variable_with_value",
+ "with_feature_set",
+)
+load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
+
+def _impl(ctx):
+ if (ctx.attr.cpu == "armhf-debian"):
+ toolchain_identifier = "clang_linux_armhf"
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ toolchain_identifier = "cortex-m4f"
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ toolchain_identifier = "cortex-m4f-k22"
+ elif (ctx.attr.cpu == "k8"):
+ toolchain_identifier = "k8_linux"
+ elif (ctx.attr.cpu == "roborio"):
+ toolchain_identifier = "roborio_linux"
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ toolchain_identifier = "stub_armeabi-v7a"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ host_system_name = "armeabi-v7a"
+ elif (ctx.attr.cpu == "armhf-debian"):
+ host_system_name = "linux"
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"
+ or ctx.attr.cpu == "k8"):
+ host_system_name = "local"
+ elif (ctx.attr.cpu == "roborio"):
+ host_system_name = "roborio"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armhf-debian"):
+ target_system_name = "arm_a15"
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ target_system_name = "armeabi-v7a"
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ target_system_name = "cortex-m4f"
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ target_system_name = "cortex-m4f-k22"
+ elif (ctx.attr.cpu == "k8"):
+ target_system_name = "k8"
+ elif (ctx.attr.cpu == "roborio"):
+ target_system_name = "roborio"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_cpu = "armeabi-v7a"
+ elif (ctx.attr.cpu == "armhf-debian"):
+ target_cpu = "armhf-debian"
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ target_cpu = "cortex-m4f"
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ target_cpu = "cortex-m4f-k22"
+ elif (ctx.attr.cpu == "k8"):
+ target_cpu = "k8"
+ elif (ctx.attr.cpu == "roborio"):
+ target_cpu = "roborio"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ target_libc = "armeabi-v7a"
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ target_libc = "cortex-m4f"
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ target_libc = "cortex-m4f-k22"
+ elif (ctx.attr.cpu == "armhf-debian"):
+ target_libc = "glibc_2.19"
+ elif (ctx.attr.cpu == "k8"):
+ target_libc = "local"
+ elif (ctx.attr.cpu == "roborio"):
+ target_libc = "roborio"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armhf-debian"
+ or ctx.attr.cpu == "k8"):
+ compiler = "clang"
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ compiler = "compiler"
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"
+ or ctx.attr.cpu == "roborio"):
+ compiler = "gcc"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ abi_version = "armeabi-v7a"
+ elif (ctx.attr.cpu == "armhf-debian"):
+ abi_version = "clang_6.0"
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ abi_version = "cortex-m4f"
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ abi_version = "cortex-m4f-k22"
+ elif (ctx.attr.cpu == "k8"):
+ abi_version = "local"
+ elif (ctx.attr.cpu == "roborio"):
+ abi_version = "roborio"
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ abi_libc_version = "armeabi-v7a"
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ abi_libc_version = "cortex-m4f"
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ abi_libc_version = "cortex-m4f-k22"
+ elif (ctx.attr.cpu == "armhf-debian"):
+ abi_libc_version = "glibc_2.19"
+ elif (ctx.attr.cpu == "k8"):
+ abi_libc_version = "local"
+ elif (ctx.attr.cpu == "roborio"):
+ abi_libc_version = "roborio"
+ else:
+ fail("Unreachable")
+
+ cc_target_os = None
+
+ builtin_sysroot = None
+
+ all_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.lto_backend,
+ ]
+
+ all_cpp_compile_actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.clif_match,
+ ]
+
+ preprocessor_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.clif_match,
+ ]
+
+ codegen_compile_actions = [
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ]
+
+ all_link_actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ]
+
+ if (ctx.attr.cpu == "roborio"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [
+ tool(
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy",
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armhf-debian"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [
+ tool(path = "linaro_linux_gcc/arm-linux-gnueabihf-objcopy"),
+ ],
+ )
+ elif (ctx.attr.cpu == "k8"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "clang_6p0/x86_64-linux-gnu-objcopy")],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ objcopy_embed_data_action = action_config(
+ action_name = "objcopy_embed_data",
+ enabled = True,
+ tools = [tool(path = "gcc_arm_none_eabi/arm-none-eabi-objcopy")],
+ )
+ else:
+ objcopy_embed_data_action = None
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ action_configs = []
+ elif (ctx.attr.cpu == "armhf-debian"
+ or ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"
+ or ctx.attr.cpu == "k8"
+ or ctx.attr.cpu == "roborio"):
+ action_configs = [objcopy_embed_data_action]
+ else:
+ fail("Unreachable")
+
+ opt_post_feature = feature(
+ name = "opt_post",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-DAOS_DEBUG=0"])],
+ ),
+ ],
+ )
+
+ supports_pic_feature = feature(name = "supports_pic", enabled = True)
+
+ if (ctx.attr.cpu == "k8"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "--sysroot=external/amd64_debian_sysroot",
+ "-nostdinc",
+ "-isystem",
+ "external/amd64_debian_sysroot/usr/include/c++/7",
+ "-isystem",
+ "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu/c++/7",
+ "-isystem",
+ "external/amd64_debian_sysroot/usr/include/c++/8/backward",
+ "-isystem",
+ "external/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/8/include",
+ "-isystem",
+ "external/clang_6p0_repo/usr/lib/llvm-6.0/lib/clang/6.0.0/include",
+ "-isystem",
+ "external/amd64_debian_sysroot/usr/include/x86_64-linux-gnu",
+ "-isystem",
+ "external/amd64_debian_sysroot/usr/include",
+ "-D__STDC_FORMAT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_LIMIT_MACROS",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DAOS_ARCHITECTURE_arm_frc",
+ "-U_FORTIFY_SOURCE",
+ "-D_FORTIFY_SOURCE=1",
+ "-fstack-protector",
+ "-fPIE",
+ "-fcolor-diagnostics",
+ "-fmessage-length=80",
+ "-fmacro-backtrace-limit=0",
+ "-Wall",
+ "-Wextra",
+ "-Wpointer-arith",
+ "-Wstrict-aliasing",
+ "-Wcast-qual",
+ "-Wcast-align",
+ "-Wwrite-strings",
+ "-Wtype-limits",
+ "-Wsign-compare",
+ "-Wformat=2",
+ "-Werror",
+ "-fno-omit-frame-pointer",
+ "-pipe",
+ "-ggdb3",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-O2",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-D__STDC_FORMAT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_LIMIT_MACROS",
+ "-D__MK22FX512__",
+ "-DF_CPU=120000000",
+ "-Wl,--gc-sections",
+ "-D__have_long32",
+ "-fstack-protector",
+ "-mcpu=cortex-m4",
+ "-mfpu=fpv4-sp-d16",
+ "-mthumb",
+ "-mfloat-abi=hard",
+ "-fno-strict-aliasing",
+ "-fmessage-length=80",
+ "-fmax-errors=20",
+ "-Wall",
+ "-Wextra",
+ "-Wpointer-arith",
+ "-Wcast-qual",
+ "-Wwrite-strings",
+ "-Wtype-limits",
+ "-Wsign-compare",
+ "-Wformat=2",
+ "-Werror",
+ "-Wstrict-aliasing=2",
+ "-Wno-misleading-indentation",
+ "-Wno-int-in-bool-context",
+ "-Wdouble-promotion",
+ "-pipe",
+ "-g",
+ "-fno-common",
+ "-ffreestanding",
+ "-fbuiltin",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-O2",
+ "-finline-functions",
+ "-ffast-math",
+ "-funroll-loops",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-D__STDC_FORMAT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_LIMIT_MACROS",
+ "-D__MK64FX512__",
+ "-DF_CPU=120000000",
+ "-Wl,--gc-sections",
+ "-D__have_long32",
+ "-fstack-protector",
+ "-mcpu=cortex-m4",
+ "-mfpu=fpv4-sp-d16",
+ "-mthumb",
+ "-mfloat-abi=hard",
+ "-fno-strict-aliasing",
+ "-fmessage-length=80",
+ "-fmax-errors=20",
+ "-Wall",
+ "-Wextra",
+ "-Wpointer-arith",
+ "-Wcast-qual",
+ "-Wwrite-strings",
+ "-Wtype-limits",
+ "-Wsign-compare",
+ "-Wformat=2",
+ "-Werror",
+ "-Wstrict-aliasing=2",
+ "-Wno-misleading-indentation",
+ "-Wno-int-in-bool-context",
+ "-Wdouble-promotion",
+ "-pipe",
+ "-g",
+ "-fno-common",
+ "-ffreestanding",
+ "-fbuiltin",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-O2",
+ "-finline-functions",
+ "-ffast-math",
+ "-funroll-loops",
+ "-DNDEBUG",
+ "-ffunction-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armhf-debian"):
+ default_compile_flags_feature = feature(
+ name = "default_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-target",
+ "armv7a-arm-linux-gnueabif",
+ "--sysroot=external/armhf_debian_rootfs",
+ "-mfloat-abi=hard",
+ "-mfpu=vfpv3-d16",
+ "-nostdinc",
+ "-isystem",
+ "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include",
+ "-isystem",
+ "external/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed",
+ "-isystem",
+ "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1/arm-linux-gnueabihf",
+ "-isystem",
+ "external/linaro_linux_gcc_repo/arm-linux-gnueabihf/include/c++/7.4.1",
+ "-isystem",
+ "external/linaro_linux_gcc_repo/include/c++/7.4.1/arm-linux-gnueabihf",
+ "-isystem",
+ "external/linaro_linux_gcc_repo/include/c++/7.4.1",
+ "-isystem",
+ "external/armhf_debian_rootfs/usr/include",
+ "-isystem",
+ "external/armhf_debian_rootfs/usr/include/arm-linux-gnueabihf",
+ "-isystem",
+ "external/org_frc971/third_party",
+ "-D__STDC_FORMAT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_LIMIT_MACROS",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DAOS_ARCHITECTURE_armhf",
+ "-U_FORTIFY_SOURCE",
+ "-fstack-protector",
+ "-fPIE",
+ "-fdiagnostics-color=always",
+ "-Wall",
+ "-Wextra",
+ "-Wpointer-arith",
+ "-Wstrict-aliasing",
+ "-Wcast-qual",
+ "-Wcast-align",
+ "-Wwrite-strings",
+ "-Wtype-limits",
+ "-Wsign-compare",
+ "-Wformat=2",
+ "-Werror",
+ "-Wunused-local-typedefs",
+ "-fno-omit-frame-pointer",
+ "-pipe",
+ "-ggdb3",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-O2",
+ "-DNDEBUG",
+ "-D_FORTIFY_SOURCE=1",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ else:
+ default_compile_flags_feature = None
+
+ if (ctx.attr.cpu == "armhf-debian"
+ or ctx.attr.cpu == "k8"):
+ dbg_feature = feature(
+ name = "dbg",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(flags = ["-DAOS_DEBUG=1"]),
+ flag_group(flags = ["-fno-omit-frame-pointer"]),
+ ],
+ ),
+ ],
+ implies = ["all_modes"],
+ )
+ elif (ctx.attr.cpu == "roborio"):
+ dbg_feature = feature(
+ name = "dbg",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(flags = ["-DAOS_DEBUG=1"]),
+ flag_group(flags = ["-fno-omit-frame-pointer"]),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ dbg_feature = feature(
+ name = "dbg",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-fno-omit-frame-pointer"])],
+ ),
+ ],
+ implies = ["all_modes"],
+ )
+ else:
+ dbg_feature = None
+
+ if (ctx.attr.cpu == "armhf-debian"
+ or ctx.attr.cpu == "k8"):
+ fastbuild_feature = feature(
+ name = "fastbuild",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-DAOS_DEBUG=0"])],
+ ),
+ ],
+ implies = ["all_modes"],
+ )
+ elif (ctx.attr.cpu == "roborio"):
+ fastbuild_feature = feature(
+ name = "fastbuild",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-DAOS_DEBUG=0"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ fastbuild_feature = feature(name = "fastbuild", implies = ["all_modes"])
+ else:
+ fastbuild_feature = None
+
+ pie_for_linking_feature = feature(
+ name = "pie_for_linking",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [ACTION_NAMES.cpp_link_executable],
+ flag_groups = [flag_group(flags = ["-pie"])],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "roborio"):
+ opt_feature = feature(
+ name = "opt",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.linkstamp_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-O2",
+ "-DNDEBUG",
+ "-D_FORTIFY_SOURCE=1",
+ "-ffunction-sections",
+ "-fdata-sections",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ],
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ ),
+ ],
+ implies = ["opt_post"],
+ )
+ elif (ctx.attr.cpu == "armhf-debian"
+ or ctx.attr.cpu == "k8"):
+ opt_feature = feature(
+ name = "opt",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-DAOS_DEBUG=0"])],
+ ),
+ ],
+ implies = ["all_modes"],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ opt_feature = feature(name = "opt", implies = ["all_modes"])
+ else:
+ opt_feature = None
+
+ pic_feature = feature(
+ name = "pic",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(flags = ["-fPIC"], expand_if_available = "pic"),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ include_paths_feature = feature(
+ name = "include_paths",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-iquote", "%{quote_include_paths}"],
+ iterate_over = "quote_include_paths",
+ ),
+ flag_group(
+ flags = ["-I%{include_paths}"],
+ iterate_over = "include_paths",
+ ),
+ flag_group(
+ flags = ["-I", "%{system_include_paths}"],
+ iterate_over = "system_include_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "roborio"):
+ include_paths_feature = feature(
+ name = "include_paths",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-iquote", "%{quote_include_paths}"],
+ iterate_over = "quote_include_paths",
+ ),
+ flag_group(
+ flags = ["-I%{include_paths}"],
+ iterate_over = "include_paths",
+ ),
+ flag_group(
+ flags = ["-isystem", "%{system_include_paths}"],
+ iterate_over = "system_include_paths",
+ ),
+ ],
+ ),
+ ],
+ )
+ else:
+ include_paths_feature = None
+
+ random_seed_feature = feature(
+ name = "random_seed",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-frandom-seed=%{output_file}"],
+ expand_if_available = "output_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "roborio"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-lstdc++",
+ "-Ltools/cpp/arm-frc-linux-gnueabi/libs",
+ "-no-canonical-prefixes",
+ "-Wl,-z,relro,-z,now",
+ "-lm",
+ "-pass-exit-codes",
+ "-Wl,--build-id=md5",
+ "-Wl,--hash-style=gnu",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f-k22"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-mcpu=cortex-m4",
+ "-mfpu=fpv4-sp-d16",
+ "-mthumb",
+ "-mfloat-abi=hard",
+ "-fno-strict-aliasing",
+ "--specs=nano.specs",
+ "-lgcc",
+ "-lstdc++_nano",
+ "-lm",
+ "-lc_nano",
+ "-Tmotors/core/kinetis_512_128.ld",
+ "-Tmotors/core/kinetis_sections.ld",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-mcpu=cortex-m4",
+ "-mfpu=fpv4-sp-d16",
+ "-mthumb",
+ "-mfloat-abi=hard",
+ "-fno-strict-aliasing",
+ "--specs=nano.specs",
+ "-lgcc",
+ "-lstdc++_nano",
+ "-lm",
+ "-lc_nano",
+ "-Tmotors/core/kinetis_512_256.ld",
+ "-Tmotors/core/kinetis_sections.ld",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "k8"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-nodefaultlibs",
+ "--sysroot=external/amd64_debian_sysroot",
+ "-lstdc++",
+ "-lc",
+ "-lgcc",
+ "-lgcc_s",
+ "-Bexternal/clang_6p0_repo/usr/bin/",
+ "-Ltools/cpp/clang_6p0/clang_more_libs",
+ "-Lexternal/amd64_debian_sysroot/usr/lib/gcc/x86_64-linux-gnu/7/",
+ "-Lexternal/amd64_debian_sysroot/usr/lib/x86_64-linux-gnu/",
+ "-Lexternal/amd64_debian_sysroot/usr/lib/",
+ "-Lexternal/amd64_debian_sysroot/lib/x86_64-linux-gnu/",
+ "-Lexternal/amd64_debian_sysroot/lib/",
+ "-no-canonical-prefixes",
+ "-fuse-ld=gold",
+ "-Wl,-z,relro,-z,now",
+ "-lm",
+ "-Wl,--build-id=md5",
+ "-Wl,--hash-style=gnu",
+ "-Wl,--warn-execstack",
+ "-Wl,--detect-odr-violations",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armhf-debian"):
+ default_link_flags_feature = feature(
+ name = "default_link_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-target",
+ "armv7a-arm-linux-gnueabif",
+ "--sysroot=external/armhf_debian_rootfs",
+ "-lstdc++",
+ "-Ltools/cpp/linaro_linux_gcc/clang_more_libs",
+ "-Lexternal/armhf_debian_rootfs/usr/lib/gcc/arm-linux-gnueabihf/8",
+ "-Lexternal/armhf_debian_rootfs/lib/arm-linux-gnueabihf",
+ "-Lexternal/armhf_debian_rootfs/usr/lib/arm-linux-gnueabihf",
+ "-Lexternal/armhf_debian_rootfs/lib",
+ "-Lexternal/armhf_debian_rootfs/usr/lib",
+ "-Lexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1",
+ "-Bexternal/linaro_linux_gcc_repo/lib/gcc/arm-linux-gnueabihf/7.4.1",
+ "-Bexternal/linaro_linux_gcc_repo/arm-linux-gnueabihf/bin",
+ "-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3",
+ "-no-canonical-prefixes",
+ "-Wl,-z,relro,-z,now",
+ "-lm",
+ "-Wl,--build-id=md5",
+ "-Wl,--hash-style=gnu",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = all_link_actions,
+ flag_groups = [flag_group(flags = ["-Wl,--gc-sections"])],
+ with_features = [with_feature_set(features = ["opt"])],
+ ),
+ ],
+ )
+ else:
+ default_link_flags_feature = None
+
+ if (ctx.attr.cpu == "roborio"):
+ all_modes_feature = feature(
+ name = "all_modes",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.c_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-std=gnu99"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-std=gnu++1z", "-fno-sized-deallocation"],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.assemble,
+ "c++-link",
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.c_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-pthread"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ all_modes_feature = feature(
+ name = "all_modes",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.c_compile,
+ ],
+ flag_groups = [flag_group(flags = ["--std=gnu99"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--std=gnu++1z", "-fno-exceptions", "-fno-rtti"],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armhf-debian"):
+ all_modes_feature = feature(
+ name = "all_modes",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.c_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-std=gnu99"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-std=gnu++1z"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.assemble,
+ "c++-link",
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.c_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-pthread"])],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "k8"):
+ all_modes_feature = feature(
+ name = "all_modes",
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.c_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-std=gnu99"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ACTION_NAMES.cpp_module_compile,
+ ],
+ flag_groups = [flag_group(flags = ["-std=gnu++1z"])],
+ ),
+ ],
+ )
+ else:
+ all_modes_feature = None
+
+ supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)
+
+ if (ctx.attr.cpu == "k8"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ "-Wno-varargs",
+ "-Wno-null-pointer-arithmetic",
+ "-Wno-mismatched-new-delete",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"
+ or ctx.attr.cpu == "roborio"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ elif (ctx.attr.cpu == "armhf-debian"):
+ unfiltered_compile_flags_feature = feature(
+ name = "unfiltered_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-no-canonical-prefixes",
+ "-Wno-builtin-macro-redefined",
+ "-Wno-mismatched-new-delete",
+ "-Wno-null-pointer-arithmetic",
+ "-Wno-varargs",
+ "-D__DATE__=\"redacted\"",
+ "-D__TIMESTAMP__=\"redacted\"",
+ "-D__TIME__=\"redacted\"",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+ else:
+ unfiltered_compile_flags_feature = None
+
+ dependency_file_feature = feature(
+ name = "dependency_file",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.objc_compile,
+ ACTION_NAMES.objcpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["-MD", "-MF", "%{dependency_file}"],
+ expand_if_available = "dependency_file",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ objcopy_embed_flags_feature = feature(
+ name = "objcopy_embed_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = ["objcopy_embed_data"],
+ flag_groups = [flag_group(flags = ["-I", "binary"])],
+ ),
+ ],
+ )
+
+ user_compile_flags_feature = feature(
+ name = "user_compile_flags",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["%{user_compile_flags}"],
+ iterate_over = "user_compile_flags",
+ expand_if_available = "user_compile_flags",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ sysroot_feature = feature(
+ name = "sysroot",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.linkstamp_compile,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ACTION_NAMES.cpp_link_executable,
+ ACTION_NAMES.cpp_link_dynamic_library,
+ ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = ["--sysroot=%{sysroot}"],
+ expand_if_available = "sysroot",
+ ),
+ ],
+ ),
+ ],
+ )
+
+ compile_flags1_feature = feature(
+ name = "compile_flags1",
+ enabled = True,
+ flag_sets = [
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "--sysroot=external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi",
+ "-nostdinc",
+ "-isystem",
+ "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include",
+ "-isystem",
+ "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ "c++-header-preprocessing",
+ ],
+ flag_groups = [flag_group(flags = ["-fno-canonical-system-headers"])],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-isystem",
+ "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0",
+ "-isystem",
+ "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi",
+ "-isystem",
+ "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward",
+ ],
+ ),
+ ],
+ ),
+ flag_set(
+ actions = [
+ ACTION_NAMES.assemble,
+ ACTION_NAMES.preprocess_assemble,
+ ACTION_NAMES.c_compile,
+ ACTION_NAMES.cpp_compile,
+ ACTION_NAMES.cpp_header_parsing,
+ ACTION_NAMES.cpp_module_compile,
+ ACTION_NAMES.cpp_module_codegen,
+ ACTION_NAMES.lto_backend,
+ ACTION_NAMES.clif_match,
+ ],
+ flag_groups = [
+ flag_group(
+ flags = [
+ "-isystem",
+ "external/arm_frc_linux_gnueabi_repo/arm-frc2020-linux-gnueabi/usr/include",
+ "-mfpu=neon",
+ "-D__STDC_FORMAT_MACROS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_LIMIT_MACROS",
+ "-D_FILE_OFFSET_BITS=64",
+ "-DAOS_ARCHITECTURE_arm_frc",
+ "-U_FORTIFY_SOURCE",
+ "-fstack-protector",
+ "-fPIE",
+ "-fdiagnostics-color=always",
+ "-Wall",
+ "-Wextra",
+ "-Wpointer-arith",
+ "-Wstrict-aliasing",
+ "-Wcast-qual",
+ "-Wwrite-strings",
+ "-Wtype-limits",
+ "-Wsign-compare",
+ "-Wformat=2",
+ "-Werror",
+ "-Wunused-local-typedefs",
+ "-Wno-psabi",
+ "-fno-omit-frame-pointer",
+ "-D__has_feature(x)=0",
+ "-pipe",
+ "-ggdb3",
+ ],
+ ),
+ ],
+ ),
+ ],
+ )
+
+ if (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ features = [
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ dbg_feature,
+ opt_feature,
+ fastbuild_feature,
+ all_modes_feature,
+ include_paths_feature,
+ objcopy_embed_flags_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "armhf-debian"
+ or ctx.attr.cpu == "k8"):
+ features = [
+ default_compile_flags_feature,
+ default_link_flags_feature,
+ opt_feature,
+ dbg_feature,
+ fastbuild_feature,
+ all_modes_feature,
+ pie_for_linking_feature,
+ supports_dynamic_linker_feature,
+ supports_pic_feature,
+ objcopy_embed_flags_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "roborio"):
+ features = [
+ default_link_flags_feature,
+ compile_flags1_feature,
+ opt_feature,
+ dependency_file_feature,
+ random_seed_feature,
+ pic_feature,
+ include_paths_feature,
+ opt_post_feature,
+ dbg_feature,
+ fastbuild_feature,
+ all_modes_feature,
+ pie_for_linking_feature,
+ supports_dynamic_linker_feature,
+ supports_pic_feature,
+ objcopy_embed_flags_feature,
+ user_compile_flags_feature,
+ sysroot_feature,
+ unfiltered_compile_flags_feature,
+ ]
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ features = [supports_pic_feature]
+ else:
+ fail("Unreachable")
+
+ if (ctx.attr.cpu == "armeabi-v7a"):
+ cxx_builtin_include_directories = []
+ elif (ctx.attr.cpu == "roborio"):
+ cxx_builtin_include_directories = [
+ "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include)%",
+ "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/lib/gcc/arm-frc2020-linux-gnueabi/7.3.0/include-fixed)%",
+ "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/arm-frc2020-linux-gnueabi)%",
+ "%package(@arm_frc_linux_gnueabi_repo//arm-frc2020-linux-gnueabi/usr/include/c++/7.3.0/backward)%",
+ ]
+ elif (ctx.attr.cpu == "k8"):
+ cxx_builtin_include_directories = [
+ "%package(@clang_6p0_repo//usr)%/lib/llvm-6.0/lib/clang/6.0.0/include",
+ "%package(@amd64_debian_sysroot//usr)%/include",
+ "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include",
+ "%package(@amd64_debian_sysroot//usr)%/lib/gcc/x86_64-linux-gnu/7/include-fixed",
+ ]
+ elif (ctx.attr.cpu == "armhf-debian"):
+ cxx_builtin_include_directories = [
+ "%package(@linaro_linux_gcc_repo//include)%",
+ "%package(@armhf_debian_rootfs//usr/include)%",
+ "%package(@linaro_linux_gcc_repo//include)%/c++/7.4.1",
+ "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include)%",
+ "%package(@linaro_linux_gcc_repo//lib/gcc/arm-linux-gnueabihf/7.4.1/include-fixed)%",
+ "%package(@linaro_linux_gcc_repo//arm-linux-gnueabihf/include)%/c++/7.4.1",
+ ]
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ cxx_builtin_include_directories = [
+ "/usr/lib/gcc/arm-none-eabi/4.8/include",
+ "/usr/lib/gcc/arm-none-eabi/4.8/include-fixed",
+ "/usr/lib/arm-none-eabi/include",
+ "/usr/include/newlib",
+ ]
+ else:
+ fail("Unreachable")
+
+ artifact_name_patterns = []
+
+ make_variables = []
+
+ if (ctx.attr.cpu == "roborio"):
+ tool_paths = [
+ tool_path(
+ name = "ar",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ar",
+ ),
+ tool_path(
+ name = "as",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-as",
+ ),
+ tool_path(
+ name = "compat-ld",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-cpp",
+ ),
+ tool_path(name = "dwp", path = "/bin/false"),
+ tool_path(
+ name = "gcc",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcc",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9",
+ ),
+ tool_path(
+ name = "ld",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-ld",
+ ),
+ tool_path(
+ name = "nm",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-nm",
+ ),
+ tool_path(
+ name = "objcopy",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "k8"):
+ tool_paths = [
+ tool_path(
+ name = "ar",
+ path = "clang_6p0/x86_64-linux-gnu-ar",
+ ),
+ tool_path(
+ name = "compat-ld",
+ path = "clang_6p0/x86_64-linux-gnu-ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "clang_6p0/x86_64-linux-gnu-cpp",
+ ),
+ tool_path(
+ name = "dwp",
+ path = "clang_6p0/x86_64-linux-gnu-dwp",
+ ),
+ tool_path(
+ name = "gcc",
+ path = "clang_6p0/x86_64-linux-gnu-clang-6.0",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "clang_6p0/x86_64-linux-gnu-gcov",
+ ),
+ tool_path(
+ name = "ld",
+ path = "clang_6p0/x86_64-linux-gnu-ld",
+ ),
+ tool_path(
+ name = "nm",
+ path = "clang_6p0/x86_64-linux-gnu-nm",
+ ),
+ tool_path(
+ name = "objcopy",
+ path = "clang_6p0/x86_64-linux-gnu-objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "clang_6p0/x86_64-linux-gnu-objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "clang_6p0/x86_64-linux-gnu-strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "cortex-m4f"
+ or ctx.attr.cpu == "cortex-m4f-k22"):
+ tool_paths = [
+ tool_path(
+ name = "ar",
+ path = "gcc_arm_none_eabi/arm-none-eabi-ar",
+ ),
+ tool_path(
+ name = "compat-ld",
+ path = "gcc_arm_none_eabi/arm-none-eabi-ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "gcc_arm_none_eabi/arm-none-eabi-cpp",
+ ),
+ tool_path(
+ name = "dwp",
+ path = "gcc_arm_none_eabi/arm-none-eabi-dwp",
+ ),
+ tool_path(
+ name = "gcc",
+ path = "gcc_arm_none_eabi/arm-none-eabi-gcc",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "gcc_arm_none_eabi/arm-none-eabi-gcov",
+ ),
+ tool_path(
+ name = "ld",
+ path = "gcc_arm_none_eabi/arm-none-eabi-ld",
+ ),
+ tool_path(
+ name = "nm",
+ path = "gcc_arm_none_eabi/arm-none-eabi-nm",
+ ),
+ tool_path(
+ name = "objcopy",
+ path = "gcc_arm_none_eabi/arm-none-eabi-objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "gcc_arm_none_eabi/arm-none-eabi-objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "gcc_arm_none_eabi/arm-none-eabi-strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "armhf-debian"):
+ tool_paths = [
+ tool_path(
+ name = "ar",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-ar",
+ ),
+ tool_path(
+ name = "compat-ld",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-ld",
+ ),
+ tool_path(
+ name = "cpp",
+ path = "linaro_linux_gcc/clang_bin/clang",
+ ),
+ tool_path(
+ name = "dwp",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-dwp",
+ ),
+ tool_path(
+ name = "gcc",
+ path = "linaro_linux_gcc/clang_bin/clang",
+ ),
+ tool_path(
+ name = "gcov",
+ path = "arm-frc-linux-gnueabi/arm-frc-linux-gnueabi-gcov-4.9",
+ ),
+ tool_path(
+ name = "ld",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-ld",
+ ),
+ tool_path(
+ name = "nm",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-nm",
+ ),
+ tool_path(
+ name = "objcopy",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-objcopy",
+ ),
+ tool_path(
+ name = "objdump",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-objdump",
+ ),
+ tool_path(
+ name = "strip",
+ path = "linaro_linux_gcc/arm-linux-gnueabihf-strip",
+ ),
+ ]
+ elif (ctx.attr.cpu == "armeabi-v7a"):
+ tool_paths = [
+ tool_path(name = "ar", path = "/bin/false"),
+ tool_path(name = "compat-ld", path = "/bin/false"),
+ tool_path(name = "cpp", path = "/bin/false"),
+ tool_path(name = "dwp", path = "/bin/false"),
+ tool_path(name = "gcc", path = "/bin/false"),
+ tool_path(name = "gcov", path = "/bin/false"),
+ tool_path(name = "ld", path = "/bin/false"),
+ tool_path(name = "nm", path = "/bin/false"),
+ tool_path(name = "objcopy", path = "/bin/false"),
+ tool_path(name = "objdump", path = "/bin/false"),
+ tool_path(name = "strip", path = "/bin/false"),
+ ]
+ else:
+ fail("Unreachable")
+
+
+ out = ctx.actions.declare_file(ctx.label.name)
+ ctx.actions.write(out, "Fake executable")
+ return [
+ cc_common.create_cc_toolchain_config_info(
+ ctx = ctx,
+ features = features,
+ action_configs = action_configs,
+ artifact_name_patterns = artifact_name_patterns,
+ cxx_builtin_include_directories = cxx_builtin_include_directories,
+ toolchain_identifier = toolchain_identifier,
+ host_system_name = host_system_name,
+ target_system_name = target_system_name,
+ target_cpu = target_cpu,
+ target_libc = target_libc,
+ compiler = compiler,
+ abi_version = abi_version,
+ abi_libc_version = abi_libc_version,
+ tool_paths = tool_paths,
+ make_variables = make_variables,
+ builtin_sysroot = builtin_sysroot,
+ cc_target_os = cc_target_os
+ ),
+ DefaultInfo(
+ executable = out,
+ ),
+ ]
+cc_toolchain_config = rule(
+ implementation = _impl,
+ attrs = {
+ "cpu": attr.string(mandatory=True, values=["armeabi-v7a", "armhf-debian", "cortex-m4f", "cortex-m4f-k22", "k8", "roborio"]),
+ },
+ provides = [CcToolchainConfigInfo],
+ executable = True,
+)