Skip to content

Commit 75213a2

Browse files
authored
Merge pull request #1526 from mbrubeck/lto
Size optimizations: Build with LTO and alloc_system
2 parents c637d44 + 8ac86d9 commit 75213a2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ test = false # no unit tests
7777
name = "rustup-init"
7878
path = "src/rustup-cli/main.rs"
7979
test = false # no unit tests
80+
81+
[profile.release]
82+
lto = true
83+
codegen-units = 1

src/rustup-cli/main.rs

+5
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ mod term2;
5555
mod errors;
5656
mod help;
5757

58+
use std::alloc::System;
5859
use std::env;
5960
use std::path::PathBuf;
6061
use errors::*;
6162
use rustup_dist::dist::TargetTriple;
6263
use rustup::env_var::RUST_RECURSION_COUNT_MAX;
6364

65+
// Always use the system allocator, to reduce binary size.
66+
#[global_allocator]
67+
static _ALLOCATOR: System = System;
68+
6469
fn main() {
6570
if let Err(ref e) = run_rustup() {
6671
common::report_error(e);

0 commit comments

Comments
 (0)