diff options
| author | Augie Fackler <augie@google.com> | 2023-09-07 11:56:25 -0400 |
|---|---|---|
| committer | Augie Fackler <augie@google.com> | 2023-09-07 11:56:25 -0400 |
| commit | 0db66022b1e0f057362be1ca8593c3ff1fee1c85 (patch) | |
| tree | 5e6b921ae355c1550aeb25a0ab3fd4c821955d08 /compiler/rustc_codegen_llvm | |
| parent | 6e5566cf03340fba678c10c17282b1fcc536c3e1 (diff) | |
| download | rust-0db66022b1e0f057362be1ca8593c3ff1fee1c85.tar.gz rust-0db66022b1e0f057362be1ca8593c3ff1fee1c85.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( |
