From 5c22c8850e97ee61c06f1daf4f61a8e21c777d41 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 29 Nov 2023 18:09:53 -0500 Subject: [PATCH] Support `.BINARY` section Resolves #12 --- src/cmd/elf2dol.rs | 2 +- src/obj/sections.rs | 2 +- src/util/asm.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cmd/elf2dol.rs b/src/cmd/elf2dol.rs index 0bc4e1d..3dcd2ad 100644 --- a/src/cmd/elf2dol.rs +++ b/src/cmd/elf2dol.rs @@ -170,7 +170,7 @@ fn section_kind(section: &object::Section) -> SectionKind { .and_then(|name| match name { ".init" | ".text" | ".vmtext" | ".dbgtext" => Some(SectionKind::Text), ".ctors" | ".dtors" | ".data" | ".rodata" | ".sdata" | ".sdata2" | "extab" - | "extabindex" => Some(SectionKind::Data), + | "extabindex" | ".BINARY" => Some(SectionKind::Data), ".bss" | ".sbss" | ".sbss2" => Some(SectionKind::UninitializedData), _ => None, }) diff --git a/src/obj/sections.rs b/src/obj/sections.rs index 03e3bfd..076b9bf 100644 --- a/src/obj/sections.rs +++ b/src/obj/sections.rs @@ -212,7 +212,7 @@ impl ObjSection { fn section_kind_for_section(section_name: &str) -> Result { Ok(match section_name { ".init" | ".text" | ".dbgtext" | ".vmtext" => ObjSectionKind::Code, - ".ctors" | ".dtors" | ".rodata" | ".sdata2" | "extab" | "extabindex" => { + ".ctors" | ".dtors" | ".rodata" | ".sdata2" | "extab" | "extabindex" | ".BINARY" => { ObjSectionKind::ReadOnlyData } ".bss" | ".sbss" | ".sbss2" => ObjSectionKind::Bss, diff --git a/src/util/asm.rs b/src/util/asm.rs index 05b3497..3a30f78 100644 --- a/src/util/asm.rs +++ b/src/util/asm.rs @@ -859,7 +859,8 @@ where write!(w, ".section {}", section.name)?; 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, ", \"a\"")?; }