diff options
| author | Augie Fackler <augie@google.com> | 2023-09-07 11:56:25 -0400 |
|---|---|---|
| committer | Augie Fackler <augie@google.com> | 2023-09-08 10:45:22 -0400 |
| commit | 9ad0396a34bdfa11fe0e4f8636f82da165ffad01 (patch) | |
| tree | 112cf16c6e59c38741ad2c1bcb511ef254d3a03d /compiler/rustc_codegen_llvm | |
| parent | 942bdf910cc85e6389546e25cfb391062095cbd8 (diff) | |
| download | rust-9ad0396a34bdfa11fe0e4f8636f82da165ffad01.tar.gz rust-9ad0396a34bdfa11fe0e4f8636f82da165ffad01.zip | |
lto: handle Apple platforms correctly by eliding __LLVM, from section name
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/lto.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index 3964039ac2d..5cf83b1accb 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -154,7 +154,10 @@ fn get_bitcode_slice_from_object_data<'a>( if obj.starts_with(b"\xDE\xC0\x17\x0B") || obj.starts_with(b"BC\xC0\xDE") { return Ok(obj); } - let section_name = bitcode_section_name(cgcx); + // 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 mut len = 0; let data = unsafe { llvm::LLVMRustGetSliceFromObjectDataByName( |
