Skip to content

Commit

Permalink
write/macho: Accept SymbolKind::Unknown for macho when writing an o…
Browse files Browse the repository at this point in the history
…bject. (gimli-rs#519)

Apple defines a bunch of segments:sections, it is tedious to deal with all of them.
Symbols from unknown sections are flagged as unknown, leading to the inability
to write it using the `writer` module.

This commit removes the check that requires symbol to be known for macho.
  • Loading branch information
thb@sb authored Mar 7, 2023
1 parent ce2261b commit 9b797de
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/write/macho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,8 @@ impl<'a> Object<'a> {
//
// Since we don't actually emit the symbol kind, we validate it here too.
match symbol.kind {
SymbolKind::Text | SymbolKind::Data | SymbolKind::Tls => {}
SymbolKind::Text | SymbolKind::Data | SymbolKind::Tls | SymbolKind::Unknown => {}
SymbolKind::File | SymbolKind::Section => continue,
SymbolKind::Unknown => {
if symbol.section != SymbolSection::Undefined {
return Err(Error(format!(
"defined symbol `{}` with unknown kind",
symbol.name().unwrap_or(""),
)));
}
}
SymbolKind::Null | SymbolKind::Label => {
return Err(Error(format!(
"unimplemented symbol `{}` kind {:?}",
Expand Down

0 comments on commit 9b797de

Please sign in to comment.