Skip to content

Commit 8381cba

Browse files
committed
Add target_mcount option
1 parent 261a915 commit 8381cba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+127
-39
lines changed

src/librustc_target/spec/aarch64_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
linker_flavor: LinkerFlavor::Gcc,
1818
options: TargetOptions {
1919
abi_blacklist: super::arm_base::abi_blacklist(),
20+
target_mcount: "\01_mcount".to_string(),
2021
.. base
2122
},
2223
})

src/librustc_target/spec/aarch64_unknown_linux_musl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
linker_flavor: LinkerFlavor::Gcc,
1818
options: TargetOptions {
1919
abi_blacklist: super::arm_base::abi_blacklist(),
20+
target_mcount: "\01_mcount".to_string(),
2021
.. base
2122
},
2223
})

src/librustc_target/spec/aarch64_unknown_netbsd.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::netbsd_base::opts();
@@ -16,6 +16,9 @@ pub fn target() -> TargetResult {
1616
target_env: String::new(),
1717
target_vendor: "unknown".to_string(),
1818
linker_flavor: LinkerFlavor::Gcc,
19-
options: base,
19+
options: TargetOptions {
20+
target_mcount: "__mcount".to_string(),
21+
.. base
22+
},
2023
})
2124
}

src/librustc_target/spec/arm_unknown_linux_gnueabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
options: TargetOptions {
1919
features: "+strict-align,+v6".to_string(),
2020
abi_blacklist: super::arm_base::abi_blacklist(),
21+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2122
.. base
2223
},
2324
})

src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
options: TargetOptions {
1919
features: "+strict-align,+v6,+vfp2".to_string(),
2020
abi_blacklist: super::arm_base::abi_blacklist(),
21+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2122
.. base
2223
}
2324
})

src/librustc_target/spec/arm_unknown_linux_musleabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn target() -> TargetResult {
2323
linker_flavor: LinkerFlavor::Gcc,
2424
options: TargetOptions {
2525
abi_blacklist: super::arm_base::abi_blacklist(),
26+
target_mcount: "\01mcount".to_string(),
2627
.. base
2728
},
2829
})

src/librustc_target/spec/arm_unknown_linux_musleabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn target() -> TargetResult {
2323
linker_flavor: LinkerFlavor::Gcc,
2424
options: TargetOptions {
2525
abi_blacklist: super::arm_base::abi_blacklist(),
26+
target_mcount: "\01mcount".to_string(),
2627
.. base
2728
},
2829
})

src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
1919
// Atomic operations provided by compiler-builtins
2020
max_atomic_width: Some(32),
2121
abi_blacklist: super::arm_base::abi_blacklist(),
22+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2223
.. base
2324
}
2425
})

src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
1919
// Atomic operations provided by compiler-builtins
2020
max_atomic_width: Some(32),
2121
abi_blacklist: super::arm_base::abi_blacklist(),
22+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2223
.. base
2324
}
2425
})

src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub fn target() -> TargetResult {
2222
// Atomic operations provided by compiler-builtins
2323
max_atomic_width: Some(32),
2424
abi_blacklist: super::arm_base::abi_blacklist(),
25+
target_mcount: "\01mcount".to_string(),
2526
.. base
2627
}
2728
})

src/librustc_target/spec/armv6_unknown_freebsd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
features: "+v6,+vfp2".to_string(),
1919
max_atomic_width: Some(64),
2020
abi_blacklist: super::arm_base::abi_blacklist(),
21+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2122
.. base
2223
}
2324
})

src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
options: TargetOptions {
1919
features: "+v6,+vfp2".to_string(),
2020
abi_blacklist: super::arm_base::abi_blacklist(),
21+
target_mcount: "__mcount".to_string(),
2122
.. base
2223
}
2324
})

src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::cloudabi_base::opts();
@@ -19,6 +19,9 @@ pub fn target() -> TargetResult {
1919
target_env: String::new(),
2020
target_vendor: "unknown".to_string(),
2121
linker_flavor: LinkerFlavor::Gcc,
22-
options: base,
22+
options: TargetOptions {
23+
target_mcount: "\01mcount".to_string(),
24+
.. base
25+
},
2326
})
2427
}

src/librustc_target/spec/armv7_unknown_freebsd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> TargetResult {
1818
features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(),
1919
max_atomic_width: Some(64),
2020
abi_blacklist: super::arm_base::abi_blacklist(),
21+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2122
.. base
2223
}
2324
})

src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub fn target() -> TargetResult {
2323
cpu: "generic".to_string(),
2424
max_atomic_width: Some(64),
2525
abi_blacklist: super::arm_base::abi_blacklist(),
26+
target_mcount: "\01__gnu_mcount_nc".to_string(),
2627
.. base
2728
}
2829
})

src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub fn target() -> TargetResult {
2626
cpu: "generic".to_string(),
2727
max_atomic_width: Some(64),
2828
abi_blacklist: super::arm_base::abi_blacklist(),
29+
target_mcount: "\01mcount".to_string(),
2930
.. base
3031
}
3132
})

src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn target() -> TargetResult {
1919
cpu: "generic".to_string(),
2020
max_atomic_width: Some(64),
2121
abi_blacklist: super::arm_base::abi_blacklist(),
22+
target_mcount: "__mcount".to_string(),
2223
.. base
2324
}
2425
})

src/librustc_target/spec/i686_apple_darwin.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::apple_base::opts();
@@ -19,6 +19,9 @@ pub fn target() -> TargetResult {
1919
target_env: String::new(),
2020
target_vendor: "apple".to_string(),
2121
linker_flavor: LinkerFlavor::Gcc,
22-
options: base,
22+
options: TargetOptions {
23+
target_mcount: "\01mcount".to_string(),
24+
.. base
25+
},
2326
})
2427
}

src/librustc_target/spec/i686_unknown_netbsd.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::netbsd_base::opts();
@@ -18,6 +18,9 @@ pub fn target() -> TargetResult {
1818
target_env: String::new(),
1919
target_vendor: "unknown".to_string(),
2020
linker_flavor: LinkerFlavor::Gcc,
21-
options: base,
21+
options: TargetOptions {
22+
target_mcount: "__mcount".to_string(),
23+
.. base
24+
},
2225
})
2326
}

src/librustc_target/spec/mips64_unknown_linux_gnuabi64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips64r2".to_string(),
1818
features: "+mips64r2".to_string(),
1919
max_atomic_width: Some(64),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mips64el_unknown_linux_gnuabi64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips64r2".to_string(),
1818
features: "+mips64r2".to_string(),
1919
max_atomic_width: Some(64),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mips_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn target() -> TargetResult {
1616
cpu: "mips32r2".to_string(),
1717
features: "+mips32r2,+fpxx,+nooddspreg".to_string(),
1818
max_atomic_width: Some(32),
19+
target_mcount: "_mcount".to_string(),
1920

2021
..super::linux_base::opts()
2122
},

src/librustc_target/spec/mips_unknown_linux_musl.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::linux_musl_base::opts();
@@ -17,6 +17,9 @@ pub fn target() -> TargetResult {
1717
target_env: "musl".to_string(),
1818
target_vendor: "unknown".to_string(),
1919
linker_flavor: LinkerFlavor::Gcc,
20-
options: base,
20+
options: TargetOptions {
21+
target_mcount: "_mcount".to_string(),
22+
.. base
23+
},
2124
})
2225
}

src/librustc_target/spec/mips_unknown_linux_uclibc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn target() -> TargetResult {
1616
cpu: "mips32r2".to_string(),
1717
features: "+mips32r2,+soft-float".to_string(),
1818
max_atomic_width: Some(32),
19+
target_mcount: "_mcount".to_string(),
1920

2021
..super::linux_base::opts()
2122
},

src/librustc_target/spec/mipsel_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips32r2".to_string(),
1818
features: "+mips32r2,+fpxx,+nooddspreg".to_string(),
1919
max_atomic_width: Some(32),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mipsel_unknown_linux_musl.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::linux_musl_base::opts();
@@ -17,6 +17,9 @@ pub fn target() -> TargetResult {
1717
target_env: "musl".to_string(),
1818
target_vendor: "unknown".to_string(),
1919
linker_flavor: LinkerFlavor::Gcc,
20-
options: base,
20+
options: TargetOptions {
21+
target_mcount: "_mcount".to_string(),
22+
.. base
23+
},
2124
})
2225
}

src/librustc_target/spec/mipsel_unknown_linux_uclibc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips32r2".to_string(),
1818
features: "+mips32r2,+soft-float".to_string(),
1919
max_atomic_width: Some(32),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mipsisa32r6_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub fn target() -> TargetResult {
1616
cpu: "mips32r6".to_string(),
1717
features: "+mips32r6".to_string(),
1818
max_atomic_width: Some(32),
19+
target_mcount: "_mcount".to_string(),
1920

2021
..super::linux_base::opts()
2122
},

src/librustc_target/spec/mipsisa32r6el_unknown_linux_gnu.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips32r6".to_string(),
1818
features: "+mips32r6".to_string(),
1919
max_atomic_width: Some(32),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mipsisa64r6_unknown_linux_gnuabi64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips64r6".to_string(),
1818
features: "+mips64r6".to_string(),
1919
max_atomic_width: Some(64),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mipsisa64r6el_unknown_linux_gnuabi64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub fn target() -> TargetResult {
1717
cpu: "mips64r6".to_string(),
1818
features: "+mips64r6".to_string(),
1919
max_atomic_width: Some(64),
20+
target_mcount: "_mcount".to_string(),
2021

2122
..super::linux_base::opts()
2223
},

src/librustc_target/spec/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ pub struct TargetOptions {
759759
/// to opt out. The default is "aliases".
760760
///
761761
/// Workaround for: https://github.com/rust-lang/rust/issues/57356
762-
pub merge_functions: MergeFunctions
762+
pub merge_functions: MergeFunctions,
763+
764+
/// Use platform dependent mcount function
765+
pub target_mcount: String
763766
}
764767

765768
impl Default for TargetOptions {
@@ -843,6 +846,7 @@ impl Default for TargetOptions {
843846
simd_types_indirect: true,
844847
override_export_symbols: None,
845848
merge_functions: MergeFunctions::Aliases,
849+
target_mcount: "mcount".to_string(),
846850
}
847851
}
848852
}
@@ -1148,6 +1152,7 @@ impl Target {
11481152
key!(simd_types_indirect, bool);
11491153
key!(override_export_symbols, opt_list);
11501154
key!(merge_functions, MergeFunctions)?;
1155+
key!(target_mcount);
11511156

11521157
if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) {
11531158
for name in array.iter().filter_map(|abi| abi.as_string()) {
@@ -1362,6 +1367,7 @@ impl ToJson for Target {
13621367
target_option_val!(simd_types_indirect);
13631368
target_option_val!(override_export_symbols);
13641369
target_option_val!(merge_functions);
1370+
target_option_val!(target_mcount);
13651371

13661372
if default.abi_blacklist != self.options.abi_blacklist {
13671373
d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()

src/librustc_target/spec/powerpc64_unknown_freebsd.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::freebsd_base::opts();
@@ -17,6 +17,9 @@ pub fn target() -> TargetResult {
1717
target_env: String::new(),
1818
target_vendor: "unknown".to_string(),
1919
linker_flavor: LinkerFlavor::Gcc,
20-
options: base,
20+
options: TargetOptions {
21+
target_mcount: "_mcount".to_string(),
22+
.. base
23+
},
2124
})
2225
}

src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult, RelroLevel};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult, RelroLevel};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::linux_base::opts();
@@ -21,6 +21,9 @@ pub fn target() -> TargetResult {
2121
target_env: "gnu".to_string(),
2222
target_vendor: "unknown".to_string(),
2323
linker_flavor: LinkerFlavor::Gcc,
24-
options: base,
24+
options: TargetOptions {
25+
target_mcount: "_mcount".to_string(),
26+
.. base
27+
},
2528
})
2629
}

src/librustc_target/spec/powerpc64_unknown_linux_musl.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{LinkerFlavor, Target, TargetResult};
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
22

33
pub fn target() -> TargetResult {
44
let mut base = super::linux_musl_base::opts();
@@ -17,6 +17,9 @@ pub fn target() -> TargetResult {
1717
target_env: "musl".to_string(),
1818
target_vendor: "unknown".to_string(),
1919
linker_flavor: LinkerFlavor::Gcc,
20-
options: base,
20+
options: TargetOptions {
21+
target_mcount: "_mcount".to_string(),
22+
.. base
23+
},
2124
})
2225
}

0 commit comments

Comments
 (0)