From 9b797de6eb63462fc0619421a350e1005079198e Mon Sep 17 00:00:00 2001 From: "thb@sb" <108470890+thb-sb@users.noreply.github.com> Date: Tue, 7 Mar 2023 00:00:00 +0000 Subject: [PATCH] write/macho: Accept `SymbolKind::Unknown` for macho when writing an object. (#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. --- src/write/macho.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/write/macho.rs b/src/write/macho.rs index 41b28365..bc7ef604 100644 --- a/src/write/macho.rs +++ b/src/write/macho.rs @@ -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 {:?}",