Skip to content

Commit

Permalink
Ensure SYMTAB in rlib's with arch code but no syms
Browse files Browse the repository at this point in the history
  • Loading branch information
aurxenon committed Mar 23, 2023
1 parent b4ae88a commit 21cbbc5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/archive_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,18 @@ fn write_symbols(
has_object: &mut bool,
) -> io::Result<Vec<u64>> {
let mut ret = vec![];
*has_object = get_symbols(buf, &mut |sym| {
// We only set has_object if get_symbols determines it's looking at an
// object file. This is because if we're creating an rlib, the archive will
// always end in lib.rmeta, and cause has_object to always become false.
if get_symbols(buf, &mut |sym| {
ret.push(sym_names.stream_position()?);
sym_names.write_all(sym)?;
sym_names.write_all(&[0])?;
Ok(())
})?;
})? == true
{
*has_object = true;
}
Ok(ret)
}

Expand Down

0 comments on commit 21cbbc5

Please sign in to comment.