mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
Merge pull request #342 from Foundation-Devices/elf-alignment
elf: fix a section alignment edge case
This commit is contained in:
commit
ea90f3a312
1 changed files with 6 additions and 2 deletions
|
|
@ -372,8 +372,12 @@ pub fn process_minielf(b: &[u8]) -> Result<MiniElf, ElfReadError> {
|
||||||
if s.get_type() != Ok(ShType::NoBits) {
|
if s.get_type() != Ok(ShType::NoBits) {
|
||||||
let section_data = s.raw_data(&elf);
|
let section_data = s.raw_data(&elf);
|
||||||
let pad_amount = if let Some(next_section) = section_iter.peek() {
|
let pad_amount = if let Some(next_section) = section_iter.peek() {
|
||||||
if section_data.len() % next_section.align() as usize != 0 {
|
if next_section.get_type() != Ok(ShType::NoBits) {
|
||||||
next_section.align() as usize - (section_data.len() % next_section.align() as usize)
|
if section_data.len() % next_section.align() as usize != 0 {
|
||||||
|
next_section.align() as usize - (section_data.len() % next_section.align() as usize)
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue