Skip to content

Commit c977596

Browse files
committed
rustc_back: add configure options for default linker and ar
Signed-off-by: Marc-Antoine Perennou <[email protected]>
1 parent aca2057 commit c977596

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

configure

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,10 @@ valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
607607
valopt release-channel "dev" "the name of the release channel to build"
608608
valopt musl-root "/usr/local" "MUSL root installation directory"
609609

610+
# Used on systems where "cc" and "ar" are unavailable
611+
valopt default-linker "cc" "the default linker"
612+
valopt default-ar "ar" "the default ar"
613+
610614
# Many of these are saved below during the "writing configuration" step
611615
# (others are conditionally saved).
612616
opt_nosave manage-submodules 1 "let the build manage the git submodules"

mk/target.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# this exists can be found on issue #2400
1414
export CFG_COMPILER_HOST_TRIPLE
1515

16+
# Used as defaults for the runtime ar and cc tools
17+
export CFG_DEFAULT_LINKER
18+
export CFG_DEFAULT_AR
19+
1620
# The standard libraries should be held up to a higher standard than any old
1721
# code, make sure that these common warnings are denied by default. These can
1822
# be overridden during development temporarily. For stage0, we allow warnings

src/librustc_back/target/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ impl Default for TargetOptions {
185185
fn default() -> TargetOptions {
186186
TargetOptions {
187187
data_layout: String::new(),
188-
linker: "cc".to_string(),
189-
ar: "ar".to_string(),
188+
linker: option_env!("CFG_DEFAULT_LINKER").unwrap_or("cc").to_string(),
189+
ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(),
190190
pre_link_args: Vec::new(),
191191
post_link_args: Vec::new(),
192192
cpu: "generic".to_string(),

0 commit comments

Comments
 (0)