Iterate sections in ELF load order: non-BSS first, BSS last.
(&self)
| 79 | pub fn data_bytes(&self) -> &[u8] { |
| 80 | self.section_bytes(&SectionKind::Data) |
| 81 | } |
| 82 | |
| 83 | pub fn rodata_bytes(&self) -> &[u8] { |
| 84 | self.section_bytes(&SectionKind::RoData) |
| 85 | } |
| 86 | |
| 87 | pub fn bss_bytes(&self) -> &[u8] { |
| 88 | self.section_bytes(&SectionKind::Bss) |
| 89 | } |
| 90 | |
| 91 | /// Total encoded size across all sections. |
| 92 | pub fn total_bytes(&self) -> usize { |
| 93 | self.sections.iter().map(|s| s.bytes.len()).sum() |
| 94 | } |
| 95 | |
| 96 | /// Returns `true` if at least one section was emitted. |
| 97 | pub fn has_sections(&self) -> bool { |
| 98 | !self.sections.is_empty() |
| 99 | } |
| 100 | |
| 101 | /// Iterate sections in ELF load order: non-BSS first, BSS last. |