Skip to content

Commit 65c840d

Browse files
committed
Ensure SYMTAB in rlib's with arch code but no syms
1 parent b4ae88a commit 65c840d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/archive_writer.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,17 @@ fn write_symbols(
408408
has_object: &mut bool,
409409
) -> io::Result<Vec<u64>> {
410410
let mut ret = vec![];
411-
*has_object = get_symbols(buf, &mut |sym| {
411+
// We only set has_object if get_symbols determines it's looking at an
412+
// object file. This is because if we're creating an rlib, the archive will
413+
// always end in lib.rmeta, and cause has_object to always become false.
414+
if get_symbols(buf, &mut |sym| {
412415
ret.push(sym_names.stream_position()?);
413416
sym_names.write_all(sym)?;
414417
sym_names.write_all(&[0])?;
415418
Ok(())
416-
})?;
419+
})? == true {
420+
*has_object = true;
421+
}
417422
Ok(ret)
418423
}
419424

0 commit comments

Comments
 (0)