return NULL;
BFD_ASSERT (elf_obj_attr_subsections (res.pbfd).size > 0);
-
- /* Shallow-copy the object attributes into output_bfd. */
- elf_obj_attr_subsections (info->output_bfd)
- = elf_obj_attr_subsections (res.pbfd);
+ /* Swap the old object attributes stored in output_bfd (i.e. the frozen
+ config) with the final merge result. */
+ LINKED_LIST_SWAP_LISTS (obj_attr_subsection_list_t)
+ (&elf_obj_attr_subsections (info->output_bfd),
+ &elf_obj_attr_subsections (res.pbfd));
/* Note: the object attributes section in the output object is copied from
the input object which was used for the merge (res.pbfd). No need to
free (data);
}
+/* Clean-up all the object attributes in a file. */
+void
+_bfd_elf_cleanup_object_attributes (bfd *abfd)
+{
+ obj_attr_subsection_list_t *plist = &elf_obj_attr_subsections (abfd);
+ obj_attr_subsection_v2_t *subsec = plist->first;
+ while (subsec != NULL)
+ subsec = oav2_subsec_delete (plist, subsec);
+}
+
/* Merge common object attributes from IBFD into OBFD. Raise an error
if there are conflicting attributes. Any processor-specific
attributes have already been merged. This must be called from the
(bfd *, obj_attr_vendor_t, obj_attr_tag_t);
extern void _bfd_elf_parse_attributes
(bfd *, Elf_Internal_Shdr *) ATTRIBUTE_HIDDEN;
+extern void _bfd_elf_cleanup_object_attributes
+ (bfd *) ATTRIBUTE_HIDDEN;
extern bfd *_bfd_elf_link_setup_object_attributes
(struct bfd_link_info *) ATTRIBUTE_HIDDEN;
extern bool _bfd_elf_merge_object_attributes
_bfd_dwarf2_cleanup_debug_info (abfd, &tdata->dwarf2_find_line_info);
_bfd_dwarf1_cleanup_debug_info (abfd, &tdata->dwarf1_find_line_info);
_bfd_stab_cleanup (abfd, &tdata->line_info);
+ _bfd_elf_cleanup_object_attributes (abfd);
for (asection *sec = abfd->sections; sec != NULL; sec = sec->next)
{
_bfd_elf_munmap_section_contents (sec, sec->contents);