In Object Attributes v2, the merge policy is not encoded within the
subsection definition. It is therefore up to the linker to determine
the appropriate policy based on the subsection's name and properties.
Unless a subsection is explicitly recognized by the linker, the
spefication of OAv2 provides no means to infer its merge policy.
Furthermore, in theory, this merge policy could vary between
attributes within the same subsection.
As a result, before beginning the merge process, ld inspects each
subsections, and attempts to identify them as either a GNU subsection,
or a backend-specific one. If this identification fails, the status
of the subsection is set to 'UNKNOWN'. Subsections marked as unknown
are then skipped during the merge process, and later pruned from the
output before the serialization.
static void
oav2_subsections_mark_unknown (const bfd *abfd)
{
- (void) abfd;
- /* TO IMPLEMENT */
+ const struct elf_backend_data *bed = get_elf_backend_data (abfd);
+ for (obj_attr_subsection_v2_t *subsec = elf_obj_attr_subsections (abfd).first;
+ subsec != NULL;
+ subsec = subsec->next)
+ {
+ if (bfd_obj_attr_v2_identify_subsection (bed, subsec->name) == NULL)
+ subsec->status = obj_attr_subsection_v2_unknown;
+ }
}
/* Merge object attributes from FROZEN into the object file ABFD.