/* ELF program property support.
- Copyright (C) 2017-2018 Free Software Foundation, Inc.
+ Copyright (C) 2017-2019 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
with ABFD. */
static bfd_boolean
-elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd,
+elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd, bfd *bbfd,
elf_property *aprop, elf_property *bprop)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if (bed->merge_gnu_properties != NULL
&& pr_type >= GNU_PROPERTY_LOPROC
&& pr_type < GNU_PROPERTY_LOUSER)
- return bed->merge_gnu_properties (info, abfd, aprop, bprop);
+ return bed->merge_gnu_properties (info, abfd, bbfd, aprop, bprop);
switch (pr_type)
{
return FALSE;
}
-/* Return the property of TYPE on *LISTP and remove it from *LISTP.
- Return NULL if not found. */
+/* Return the property of TYPE on *LISTP and remove it from *LISTP if RM is
+ true. Return NULL if not found. */
static elf_property *
elf_find_and_remove_property (elf_property_list **listp,
- unsigned int type, bfd_boolean remove)
+ unsigned int type, bfd_boolean rm)
{
elf_property_list *list;
if (type == list->property.pr_type)
{
/* Remove this property. */
- if (remove)
+ if (rm)
*listp = list->next;
return &list->property;
}
TRUE);
/* Pass NULL to elf_merge_gnu_properties for the property which
isn't on *LISTP. */
- elf_merge_gnu_properties (info, first_pbfd, &p->property, pr);
+ elf_merge_gnu_properties (info, first_pbfd, abfd, &p->property, pr);
if (p->property.pr_kind == property_remove)
{
if (info->has_map_file)
(bfd_vma) p->property.pr_type, first_pbfd, abfd);
}
}
- else
- {
- /* Remove this property. */
- *lastp = p->next;
- continue;
- }
+
+ /* Remove this property. */
+ *lastp = p->next;
+ continue;
}
else if (number_p)
{
else
number_p = FALSE;
- if (elf_merge_gnu_properties (info, first_pbfd, NULL, &p->property))
+ if (elf_merge_gnu_properties (info, first_pbfd, abfd, NULL, &p->property))
{
if (p->property.pr_type == GNU_PROPERTY_NO_COPY_ON_PROTECTED)
elf_has_no_copy_on_protected (first_pbfd) = TRUE;
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
if (abfd != first_pbfd
- && (abfd->flags & (DYNAMIC | BFD_PLUGIN)) == 0)
+ && (abfd->flags & (DYNAMIC | BFD_PLUGIN | BFD_LINKER_CREATED)) == 0)
{
elf_property_list *null_ptr = NULL;
elf_property_list **listp = &null_ptr;
align_shift = bed->s->elfclass == ELFCLASS64 ? 3 : 2;
/* Get the output .note.gnu.property section size. */
- size = bfd_get_section_size (isec->output_section);
+ size = bfd_section_size (isec->output_section);
/* Update the output .note.gnu.property section alignment. */
- bfd_set_section_alignment (obfd, isec->output_section, align_shift);
+ bfd_set_section_alignment (isec->output_section, align_shift);
- if (size > bfd_get_section_size (isec))
+ if (size > bfd_section_size (isec))
{
contents = (bfd_byte *) bfd_malloc (size);
free (*ptr);