Rollup merge of #154566 - heiher:loong-mcount-sym, r=chenyukang

loongarch: use "_mcount" as the default mcount symbol

Set the `mcount` field to "_mcount" for all LoongArch targets to match Clang/GCC behavior [1]. This fixes linking failures when using `-Z instrument-mcount`, where the runtime expects "_mcount" instead of "mcount".

[1] https://github.com/llvm/llvm-project/blob/main/clang/lib/Basic/Targets/LoongArch.h#L60
This commit is contained in:
Jacob Pratt
2026-03-30 05:13:18 -04:00
committed by GitHub
7 changed files with 7 additions and 0 deletions
@@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
linker: Some("rust-lld".into()),
llvm_abiname: LlvmAbi::Ilp32d,
max_atomic_width: Some(32),
mcount: "_mcount".into(),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
..Default::default()
@@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
linker: Some("rust-lld".into()),
llvm_abiname: LlvmAbi::Ilp32s,
max_atomic_width: Some(32),
mcount: "_mcount".into(),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
..Default::default()
@@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
features: "+f,+d,+lsx,+relax".into(),
llvm_abiname: LlvmAbi::Lp64d,
max_atomic_width: Some(64),
mcount: "_mcount".into(),
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
@@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
features: "+f,+d,+lsx,+relax".into(),
llvm_abiname: LlvmAbi::Lp64d,
max_atomic_width: Some(64),
mcount: "_mcount".into(),
crt_static_default: false,
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
@@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
features: "+f,+d,+lsx,+relax".into(),
llvm_abiname: LlvmAbi::Lp64d,
max_atomic_width: Some(64),
mcount: "_mcount".into(),
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
@@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
linker: Some("rust-lld".into()),
llvm_abiname: LlvmAbi::Lp64d,
max_atomic_width: Some(64),
mcount: "_mcount".into(),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
code_model: Some(CodeModel::Medium),
@@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
linker: Some("rust-lld".into()),
llvm_abiname: LlvmAbi::Lp64s,
max_atomic_width: Some(64),
mcount: "_mcount".into(),
relocation_model: RelocModel::Static,
panic_strategy: PanicStrategy::Abort,
code_model: Some(CodeModel::Medium),