Support `.BINARY` section

Resolves #12
This commit is contained in:
Luke Street 2023-11-29 18:09:53 -05:00
parent 4cb6f4f85d
commit 5c22c8850e
3 changed files with 4 additions and 3 deletions

View File

@ -170,7 +170,7 @@ fn section_kind(section: &object::Section) -> SectionKind {
.and_then(|name| match name { .and_then(|name| match name {
".init" | ".text" | ".vmtext" | ".dbgtext" => Some(SectionKind::Text), ".init" | ".text" | ".vmtext" | ".dbgtext" => Some(SectionKind::Text),
".ctors" | ".dtors" | ".data" | ".rodata" | ".sdata" | ".sdata2" | "extab" ".ctors" | ".dtors" | ".data" | ".rodata" | ".sdata" | ".sdata2" | "extab"
| "extabindex" => Some(SectionKind::Data), | "extabindex" | ".BINARY" => Some(SectionKind::Data),
".bss" | ".sbss" | ".sbss2" => Some(SectionKind::UninitializedData), ".bss" | ".sbss" | ".sbss2" => Some(SectionKind::UninitializedData),
_ => None, _ => None,
}) })

View File

@ -212,7 +212,7 @@ impl ObjSection {
fn section_kind_for_section(section_name: &str) -> Result<ObjSectionKind> { fn section_kind_for_section(section_name: &str) -> Result<ObjSectionKind> {
Ok(match section_name { Ok(match section_name {
".init" | ".text" | ".dbgtext" | ".vmtext" => ObjSectionKind::Code, ".init" | ".text" | ".dbgtext" | ".vmtext" => ObjSectionKind::Code,
".ctors" | ".dtors" | ".rodata" | ".sdata2" | "extab" | "extabindex" => { ".ctors" | ".dtors" | ".rodata" | ".sdata2" | "extab" | "extabindex" | ".BINARY" => {
ObjSectionKind::ReadOnlyData ObjSectionKind::ReadOnlyData
} }
".bss" | ".sbss" | ".sbss2" => ObjSectionKind::Bss, ".bss" | ".sbss" | ".sbss2" => ObjSectionKind::Bss,

View File

@ -859,7 +859,8 @@ where
write!(w, ".section {}", section.name)?; write!(w, ".section {}", section.name)?;
write!(w, ", \"a\", @nobits")?; write!(w, ", \"a\", @nobits")?;
} }
".ctors" | ".dtors" | ".ctors$10" | ".dtors$10" | ".dtors$15" | "extab" | "extabindex" => { ".ctors" | ".dtors" | ".ctors$10" | ".dtors$10" | ".dtors$15" | "extab" | "extabindex"
| ".BINARY" => {
write!(w, ".section {}", section.name)?; write!(w, ".section {}", section.name)?;
write!(w, ", \"a\"")?; write!(w, ", \"a\"")?;
} }