Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure SYMTAB in rlib's with arch code but no syms #5

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/archive_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,17 @@ 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(())
})?;
})? {
*has_object = true;
}
Ok(ret)
}

Expand Down