Objcopy interleave fails if section address not multiple of interleave.
PR 22465 binutils/ * objcopy.c (copy_section): New local extra. If isection->lma not exactly divisible by interleave, then bias from. Also adjust osection->lma if necessary. ld/ * testsuite/ld-elf/interleave-0.d, testsuite/ld-elf/interleave-4.d, * testsuite/ld-elf/interleave.ld, testsuite/ld-elf/interleave.s: New.
This commit is contained in:
parent
7cc244debb
commit
1c9c7ce078
7 changed files with 69 additions and 0 deletions
|
@ -3898,6 +3898,15 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
char *end = (char *) memhunk + size;
|
||||
int i;
|
||||
|
||||
/* If the section address is not exactly divisible by the interleave,
|
||||
then we must bias the from address. If the copy_byte is less than
|
||||
the bias, then we must skip forward one interleave, and increment
|
||||
the final lma. */
|
||||
int extra = isection->lma % interleave;
|
||||
from -= extra;
|
||||
if (copy_byte < extra)
|
||||
from += interleave;
|
||||
|
||||
for (; from < end; from += interleave)
|
||||
for (i = 0; i < copy_width; i++)
|
||||
{
|
||||
|
@ -3908,6 +3917,8 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg)
|
|||
|
||||
size = (size + interleave - 1 - copy_byte) / interleave * copy_width;
|
||||
osection->lma /= interleave;
|
||||
if (copy_byte < extra)
|
||||
osection->lma++;
|
||||
}
|
||||
|
||||
if (!bfd_set_section_contents (obfd, osection, memhunk, 0, size))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue