diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-30 06:40:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-30 06:40:37 +0100 |
| commit | cf2cc010a33b6aa9bd480e1ffa13a8d6ca181ea8 (patch) | |
| tree | f8493678c7234890de4663496e93b9d68d72a444 /compiler/rustc_codegen_llvm/src/back/lto.rs | |
| parent | 2055237e8f7087db9a7ca4c0b9921cbc858f345a (diff) | |
| parent | 65ff2a6ad71de45c848a622d86b6c74092e1b734 (diff) | |
| download | rust-cf2cc010a33b6aa9bd480e1ffa13a8d6ca181ea8.tar.gz rust-cf2cc010a33b6aa9bd480e1ffa13a8d6ca181ea8.zip | |
Rollup merge of #132340 - Zalathar:set-section, r=compiler-errors
cg_llvm: Consistently use safe wrapper function `set_section` Follow-up to #131962 and https://github.com/rust-lang/rust/pull/132260#discussion_r1821626260. To avoid too much scope creep, I've deliberately kept the changes to `LLVMRustGetSliceFromObjectDataByName` as minimal as possible.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/lto.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/lto.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 02149e176ea..48beb9be2b2 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -165,13 +165,14 @@ fn get_bitcode_slice_from_object_data<'a>( // We drop the "__LLVM," prefix here because on Apple platforms there's a notion of "segment // name" which in the public API for sections gets treated as part of the section name, but // internally in MachOObjectFile.cpp gets treated separately. - let section_name = bitcode_section_name(cgcx).trim_start_matches("__LLVM,"); + let section_name = bitcode_section_name(cgcx).to_str().unwrap().trim_start_matches("__LLVM,"); let mut len = 0; let data = unsafe { llvm::LLVMRustGetSliceFromObjectDataByName( obj.as_ptr(), obj.len(), section_name.as_ptr(), + section_name.len(), &mut len, ) }; |
