third_party.pigweed.src/targets/host/linux.gni
Alexei Frolov 3fde6b116f pw_toolchain_size_report template
This change adds a GN template which creates a size report card across
a set of different toolchains. The toolchains are defined in a build
variable, each with an optional linker script and Bloaty config. The
size report template builds a base and diff executable with each of the
toolchains and compares the size difference of each.

Example output for the host target:

             simple_bloat_toolchain
             ──────────────────────
┌───────────┬─────────┬────────┬───────┬───────┐
│   Label   │ Segment │ Before │ Delta │ After │
├═══════════┼═════════┼════════┼═══════┼═══════┤
│   gcc -Og │    CODE │    413 │   +32 │   445 │
│           │     RAM │    576 │    +8 │   584 │
├───────────┼─────────┼────────┼───────┼───────┤
│   gcc -Os │    CODE │    429 │   +16 │   445 │
│           │     RAM │    576 │    +8 │   584 │
├───────────┼─────────┼────────┼───────┼───────┤
│   gcc -O2 │    CODE │    429 │   +32 │   461 │
│           │     RAM │    576 │    +8 │   584 │
├───────────┼─────────┼────────┼───────┼───────┤
│ clang -Og │    CODE │    448 │   +32 │   480 │
│           │     RAM │    113 │   +15 │   128 │
├───────────┼─────────┼────────┼───────┼───────┤
│ clang -Os │    CODE │    432 │   +16 │   448 │
│           │     RAM │    113 │   +15 │   128 │
├───────────┼─────────┼────────┼───────┼───────┤
│ clang -O2 │    CODE │    448 │   +80 │   528 │
│           │     RAM │    113 │   +15 │   128 │
└───────────┴─────────┴────────┴───────┴───────┘

Change-Id: I2c65f4d4f61354b9779628f207297eacd04470b9
2019-12-23 20:37:42 +00:00

59 lines
1.8 KiB
Plaintext

# Copyright 2019 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("host_common.gni")
declare_args() {
# Specifies the toolchain to use for this build.
pw_target_toolchain = "$dir_pw_toolchain:host_gcc_og"
}
pw_size_report_toolchains = [
{
name = "x86_64-gcc -Og"
target = "$dir_pw_toolchain:host_gcc_og"
bloaty_config = get_path_info("linux.bloaty", "abspath")
},
{
name = "x86_64-gcc -Os"
target = "$dir_pw_toolchain:host_gcc_os"
bloaty_config = get_path_info("linux.bloaty", "abspath")
},
{
name = "x86_64-gcc -O2"
target = "$dir_pw_toolchain:host_gcc_o2"
bloaty_config = get_path_info("linux.bloaty", "abspath")
},
{
name = "x86_64-clang -Og"
target = "$dir_pw_toolchain:host_clang_og"
bloaty_config = get_path_info("linux.bloaty", "abspath")
},
{
name = "x86_64-clang -Os"
target = "$dir_pw_toolchain:host_clang_os"
bloaty_config = get_path_info("linux.bloaty", "abspath")
},
{
name = "x86_64-clang -O2"
target = "$dir_pw_toolchain:host_clang_o2"
bloaty_config = get_path_info("linux.bloaty", "abspath")
},
]
pw_executable_config.bloaty_config_file =
get_path_info("linux.bloaty", "abspath")
pw_automatic_test_runner = get_path_info("run_test", "abspath")