Skip to content
Open
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
11 changes: 7 additions & 4 deletions crates/brioche-autopack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,16 @@ fn autopack_kind(path: &Path) -> eyre::Result<Option<AutopackKind>> {
return Ok(None);
};

// Only ET_EXEC and ET_DYN can potentially be packed
// Only ET_EXEC and ET_DYN can potentially be packed.
// Check if it's a library first. A shared library can
// have an interpreter section and it should be packed
// as SharedLibrary, not DynamicBinary.
match elf_object.header.e_type {
goblin::elf::header::ET_EXEC | goblin::elf::header::ET_DYN => {
if elf_object.interpreter.is_some() {
Ok(Some(AutopackKind::DynamicBinary))
} else if elf_object.is_lib {
if elf_object.is_lib {
Ok(Some(AutopackKind::SharedLibrary))
} else if elf_object.interpreter.is_some() {
Ok(Some(AutopackKind::DynamicBinary))
} else {
Ok(None)
}
Expand Down