Bug 1409680 - Extend --disable-debug-symbols to Rust code. r?glandium
This reduces disk I/O and memory usage during build that already lacks
debugging symbols from C++ code, allowing to use more jobs on 32bit hosts.
--disable-debug-symbols build on FreeBSD 10.3 i386 (8 cores) host:
Max RSS before: libxul - 612 Mb, libgkrust - 1908 Mb
Max RSS after: libxul - 444 Mb, libgkrust - 1471 Mb
Binary before: libxul - 203 Mb, libgkrust - 732 Mb
Binary after: libxul - 123 Mb, libgkrust - 301 Mb
MozReview-Commit-ID: 40UEYuKddZ2
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -914,17 +914,19 @@ rust_unlock_unstable =
ifdef MOZ_RUST_SIMD
rust_unlock_unstable += RUSTC_BOOTSTRAP=1
endif
ifdef MOZ_USING_SCCACHE
sccache_wrap := RUSTC_WRAPPER='$(CCACHE)'
endif
+ifdef MOZ_DEBUG_SYMBOLS
default_rustflags += -C debuginfo=2
+endif
# We use the + prefix to pass down the jobserver fds to cargo, but we
# don't use the prefix when make -n is used, so that cargo doesn't run
# in that case)
define RUN_CARGO
$(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env $(environment_cleaner) $(rust_unlock_unstable) $(rustflags_override) $(sccache_wrap) \
CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
RUSTC=$(RUSTC) \