Skip to content

Commit c59bb49

Browse files
committed
Correct target_family mess
1 parent 474eb62 commit c59bb49

14 files changed

+19
-13
lines changed

src/librustc/session/config.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -943,26 +943,20 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
943943
let vendor = &sess.target.target.target_vendor;
944944
let max_atomic_width = sess.target.target.max_atomic_width();
945945

946-
let fam = if let Some(ref fam) = sess.target.target.options.target_family {
947-
Symbol::intern(fam)
948-
} else if sess.target.target.options.is_like_windows {
949-
Symbol::intern("windows")
950-
} else {
951-
Symbol::intern("unix")
952-
};
953-
954946
let mut ret = HashSet::new();
955947
// Target bindings.
956948
ret.insert((Symbol::intern("target_os"), Some(Symbol::intern(os))));
957-
ret.insert((Symbol::intern("target_family"), Some(fam)));
949+
if let Some(fam) = sess.target.target.options.target_family {
950+
ret.insert((Symbol::intern("target_family"), Some(fam)));
951+
if fam == "windows" || fam == "unix" {
952+
ret.insert((fam, None));
953+
}
954+
}
958955
ret.insert((Symbol::intern("target_arch"), Some(Symbol::intern(arch))));
959956
ret.insert((Symbol::intern("target_endian"), Some(Symbol::intern(end))));
960957
ret.insert((Symbol::intern("target_pointer_width"), Some(Symbol::intern(wordsz))));
961958
ret.insert((Symbol::intern("target_env"), Some(Symbol::intern(env))));
962959
ret.insert((Symbol::intern("target_vendor"), Some(Symbol::intern(vendor))));
963-
if fam == "windows" || fam == "unix" {
964-
ret.insert((fam, None));
965-
}
966960
if sess.target.target.options.has_elf_tls {
967961
ret.insert((Symbol::intern("target_thread_local"), None));
968962
}

src/librustc_back/target/apple_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub fn opts() -> TargetOptions {
3737
function_sections: false,
3838
dynamic_linking: true,
3939
executables: true,
40+
target_family: Some("unix".to_string()),
4041
is_like_osx: true,
4142
has_rpath: true,
4243
dll_prefix: "lib".to_string(),

src/librustc_back/target/bitrig_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
position_independent_executables: true,

src/librustc_back/target/dragonfly_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
pre_link_args: vec![

src/librustc_back/target/freebsd_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
pre_link_args: vec![

src/librustc_back/target/fuchsia_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
pre_link_args: vec![

src/librustc_back/target/haiku_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn opts() -> TargetOptions {
1717
dynamic_linking: true,
1818
executables: true,
1919
has_rpath: true,
20+
target_family: Some("unix".to_string()),
2021
linker_is_gnu: true,
2122
.. Default::default()
2223
}

src/librustc_back/target/linux_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
pre_link_args: vec![

src/librustc_back/target/netbsd_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
pre_link_args: vec![

src/librustc_back/target/openbsd_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn opts() -> TargetOptions {
1515
TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
18+
target_family: Some("unix".to_string()),
1819
linker_is_gnu: true,
1920
has_rpath: true,
2021
is_like_openbsd: true,

src/librustc_back/target/redox_base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn opts() -> TargetOptions {
3838
relocation_model: "static".to_string(),
3939
disable_redzone: true,
4040
eliminate_frame_pointer: false,
41-
target_family: Some("redox".to_string()),
41+
target_family: None,
4242
linker_is_gnu: true,
4343
no_default_libraries: true,
4444
lib_allocation_crate: "alloc_system".to_string(),

src/librustc_back/target/solaris_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn opts() -> TargetOptions {
1616
dynamic_linking: true,
1717
executables: true,
1818
has_rpath: true,
19+
target_family: Some("unix".to_string()),
1920
is_like_solaris: true,
2021
exe_allocation_crate: super::maybe_jemalloc(),
2122

src/librustc_back/target/windows_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub fn opts() -> TargetOptions {
2424
staticlib_prefix: "".to_string(),
2525
staticlib_suffix: ".lib".to_string(),
2626
no_default_libraries: true,
27+
target_family: Some("windows".to_string()),
2728
is_like_windows: true,
2829
allows_weak_linkage: false,
2930
pre_link_args: vec![

src/librustc_back/target/windows_msvc_base.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub fn opts() -> TargetOptions {
5353
exe_suffix: ".exe".to_string(),
5454
staticlib_prefix: "".to_string(),
5555
staticlib_suffix: ".lib".to_string(),
56+
target_family: Some("windows".to_string()),
5657
is_like_windows: true,
5758
is_like_msvc: true,
5859
pre_link_args: vec![

0 commit comments

Comments
 (0)