mirror of
https://github.com/serge1/ELFIO.git
synced 2025-01-14 03:41:22 +00:00
Fix offset calculation for the case where section's align field is zero
This commit is contained in:
parent
c46fe2a371
commit
f2e17bac87
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -641,8 +641,12 @@ class elfio
|
||||
else if (!section_generated[index]) {
|
||||
// If no address has been specified then only the section
|
||||
// alignment constraint has to be matched
|
||||
Elf64_Off error = current_file_pos % sec->get_addr_align();
|
||||
secAlign = ( sec->get_addr_align() - error ) % sec->get_addr_align();
|
||||
Elf_Xword align = sec->get_addr_align();
|
||||
if (align == 0) {
|
||||
align = 1;
|
||||
}
|
||||
Elf64_Off error = current_file_pos % align;
|
||||
secAlign = ( align - error ) % align;
|
||||
}
|
||||
else {
|
||||
// Alignment for already generated sections
|
||||
|
Loading…
Reference in New Issue
Block a user