scripts: crosfw: Support disabling LTO
LTO makes the build quite slow, particularly with the link step.
Incremental builds for sandbox go from about 3 seconds to 8 seconds.
For development it is normally not important to use LTO, so add an
option to disable it.
BUG=b:268384689
TEST=Compare incremental build times:
$ crosfw sandbox
$ time crosfw sandbox
real 0m8.137s
user 1m12.592s
sys 0m6.910s
$ crosfw sandbox -L
$ time crosfw sandbox -L
real 0m3.153s
user 0m4.605s
sys 0m2.379s
Change-Id: I9fcdeda41a0b8829a5ab17f02390bf3b709ff2d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4248404
Commit-Queue: Simon Glass <sjg@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
diff --git a/scripts/crosfw.py b/scripts/crosfw.py
index 6511621..2766c7c 100644
--- a/scripts/crosfw.py
+++ b/scripts/crosfw.py
@@ -249,6 +249,14 @@
help="Run distclean and reconfigure before building",
)
parser.add_argument(
+ "-L",
+ "--no-lto",
+ dest="lto",
+ action="store_false",
+ default=True,
+ help="Disable Link-time Optimisation (LTO) when building",
+ )
+ parser.add_argument(
"-O",
"--objdump",
action="store_true",
@@ -425,6 +433,9 @@
"QEMU_ARCH=",
]
+ if not options.lto:
+ base.append("NO_LTO=1")
+
# Enable quiet output at INFO level, everything at DEBUG level
if logging.getLogger().getEffectiveLevel() <= logging.DEBUG:
base.append("V=1")