https://sourceware.org/bugzilla/show_bug.cgi?id=31540
--- Comment #1 from vijay Shankar <shank.vijay at yandex dot com> --- I have a patch suggestion for this issue added check to copy_private_bfd_data so that sections with inconsistent relation between vma and lma go to re-write im not sure how this will affect other cases maybe linker scripts? waiting on experts opinion on this change. alternative way would be to exclude tbss from PT_LOAD by adding checks in releavent places ( ELF_SECTION_IN_SEGMENT_1, make_mapping ). diff --git a/bfd/elf.c b/bfd/elf.c index c305b40e..b45e1eee 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -8394,7 +8394,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) /* Check to see if any sections in the input BFD covered by ELF program header have changed. */ Elf_Internal_Phdr *segment; - asection *section, *osec; + asection *section, *osec, *prev; unsigned int i, num_segments; Elf_Internal_Shdr *this_hdr; const struct elf_backend_data *bed; @@ -8425,7 +8425,7 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) || segment->p_type == PT_DYNAMIC)) goto rewrite; - for (section = ibfd->sections; + for (section = ibfd->sections,prev=section; section != NULL; section = section->next) { /* We mark the output section so that we know it comes @@ -8440,16 +8440,21 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) { /* FIXME: Check if its output section is changed or removed. What else do we need to check? */ + /* make sure this sections vma and lma relation is + same as previous section otherwise it needs a + rewrite */ if (osec == NULL || section->flags != osec->flags || section->lma != osec->lma || section->vma != osec->vma || section->size != osec->size || section->rawsize != osec->rawsize - || section->alignment_power != osec->alignment_power) + || section->alignment_power != osec->alignment_power + || section->lma - section->vma != prev->lma - prev->vma) goto rewrite; } } + prev = section; } /* Check to see if any output section do not come from the -- You are receiving this mail because: You are on the CC list for the bug.