Skip to content

Commit ff6a980

Browse files
authored
Rollup merge of #140433 - BjoernLange:master, r=nnethercote
Replace the \01__gnu_mcount_nc to LLVM intrinsic for additional ARM targets This is an extension to #113814 which seems to have missed two targets which also need this patch for instrumentation with `-Z instrument-mcount` to work correctly. For anyone who might stumble over this issue again in the future: As a workaround one can dump the current target configuration using ``` rustc +nightly -Z unstable-options --target armv7-unknown-linux-gnueabihf --print target-spec-json ``` (assuming `armv7-unknown-linux-gnueabihf` is the target to build for) add the line ``` "llvm-mcount-intrinsic": "llvm.arm.gnu.eabi.mcount", ``` and compile with ``` RUSTFLAGS="-Z instrument-mcount -C passes=ee-instrument<post-inline>" cargo +nightly build -Z build-std --target <path to directory with modified target config>/armv7-unknown-linux-gnueabihf.json ``` It might be necessary to set the compiler for cross compiling using something like ``` export TARGET_CC=arm-linux-gnueabihf-gcc ```
2 parents 561f6a1 + 6aea9f4 commit ff6a980

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
2020
max_atomic_width: Some(32),
2121
mcount: "\u{1}__gnu_mcount_nc".into(),
2222
has_thumb_interworking: true,
23+
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
2324
..base::linux_gnu::opts()
2425
},
2526
}

compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
2222
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
2323
max_atomic_width: Some(64),
2424
mcount: "\u{1}__gnu_mcount_nc".into(),
25+
llvm_mcount_intrinsic: Some("llvm.arm.gnu.eabi.mcount".into()),
2526
..base::linux_gnu::opts()
2627
},
2728
}

0 commit comments

Comments
 (0)