Skip to content

Commit bdf7835

Browse files
committed
lto: also handle macho and aix section names
1 parent cca2388 commit bdf7835

File tree

1 file changed

+6
-1
lines changed
  • compiler/rustc_codegen_llvm/src/back

1 file changed

+6
-1
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,12 @@ fn get_bitcode_slice_from_object_data(obj: &[u8]) -> Result<&[u8], LtoBitcodeFro
151151
return Ok(obj);
152152
}
153153
match object::read::File::parse(obj) {
154-
Ok(f) => match f.section_by_name(".llvmbc").or_else(|| f.section_by_name(".llvm.lto")) {
154+
Ok(f) => match f
155+
.section_by_name(".llvmbc")
156+
.or_else(|| f.section_by_name(".llvm.lto"))
157+
.or_else(|| f.section_by_name("__LLVM,__bitcode\0"))
158+
.or_else(|| f.section_by_name(".ipa\0"))
159+
{
155160
Some(d) => Ok(d.data().unwrap()),
156161
None => Err(LtoBitcodeFromRlib {
157162
llvm_err: "Bitcode section not found in object file".to_string(),

0 commit comments

Comments
 (0)