[VMS]: Fix thinko in elfNN_vms_object_p
Tristan Gingold
gingold@adacore.com
Fri Feb 10 10:08:00 GMT 2012
Hi,
elfNN_vms_object_p has dedicated code to create missing sections for phdrs, as the VMS native linker doesn't create shdrs for code/data in executables.
There was a thinko in this code, which results in an infinite loop.
This patch fixes this issue and adds some comments.
Manually tested.
Committed on trunk.
Tristan.
bfd/
2012-02-10 Tristan Gingold <gingold@adacore.com>
* elfnn-ia64.c (elfNN_vms_object_p): Change comparison operator
to avoid infinite loop. Add comments.
Index: elfnn-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfnn-ia64.c,v
retrieving revision 1.4
diff -c -r1.4 elfnn-ia64.c
*** elfnn-ia64.c 11 Jul 2011 13:54:52 -0000 1.4
--- elfnn-ia64.c 10 Feb 2012 10:00:16 -0000
***************
*** 5036,5053 ****
flagword flags;
char *nname = NULL;
! /* Find a section covering base_vma. */
for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
! if ((sec->flags & (SEC_ALLOC | SEC_LOAD)) == 0)
continue;
! if (sec->vma <= base_vma && sec->vma + sec->size > base_vma)
{
base_vma = sec->vma + sec->size;
goto again;
}
! if (sec->vma < next_vma && sec->vma + sec->size >= base_vma)
! next_vma = sec->vma;
}
/* No section covering [base_vma; next_vma). Create a fake one. */
--- 5036,5062 ----
flagword flags;
char *nname = NULL;
! /* Find a section covering [base_vma;limit_vma) */
for (sec = abfd->sections; sec != NULL; sec = sec->next)
{
! /* Skip uninteresting sections (either not in memory or
! below base_vma. */
! if ((sec->flags & (SEC_ALLOC | SEC_LOAD)) == 0
! || sec->vma + sec->size <= base_vma)
continue;
! if (sec->vma <= base_vma)
{
+ /* This section covers (maybe partially) the beginning
+ of the range. */
base_vma = sec->vma + sec->size;
goto again;
}
! if (sec->vma < next_vma)
! {
! /* This section partially covers the end of the range.
! Used to compute the size of the hole. */
! next_vma = sec->vma;
! }
}
/* No section covering [base_vma; next_vma). Create a fake one. */
More information about the Binutils
mailing list