bfd_make_section_anyway error recovery buglet
John Marshall
jmarshall@acm.org
Thu Nov 1 17:12:00 GMT 2001
In bfd_make_section_anyway, if bfd_make_empty_symbol or a new_section_hook
fails, the new section gets backed out and not added to the bfd. But the
two counts below still get incremented, leading to the bfd's list of
sections being out of sync with its section_count, and thence to
BFD: BFD internal error, aborting [...] in bfd_map_over_sections
(I'm not copyright assigned, but I think this should be small enough not
to need it. I will send off the request-assign.future that Nick's posted
a couple of times in case any of the bigger things I want to look at come
to fruition. :-))
2001-11-12 John Marshall <jmarshall@acm.org>
section.c (bfd_make_section_anyway): Don't increment section_id and
the BFD's section_count if adding the section failed.
--- section.c.orig Fri Nov 9 13:31:11 2001
+++ section.c Mon Nov 12 22:23:17 2001
@@ -796,8 +796,8 @@ bfd_make_section_anyway (abfd, name)
return NULL;
newsect->name = name;
- newsect->id = section_id++;
- newsect->index = abfd->section_count++;
+ newsect->id = section_id;
+ newsect->index = abfd->section_count;
newsect->flags = SEC_NO_FLAGS;
newsect->userdata = NULL;
@@ -831,6 +831,8 @@ bfd_make_section_anyway (abfd, name)
return NULL;
}
+ section_id++;
+ abfd->section_count++;
*prev = newsect;
return newsect;
}
More information about the Binutils
mailing list