{
bad_size:
_bfd_error_handler
- (_("warning: %B: corrupt GNU_PROPERTY_TYPE (%ld) size: %#lx\n"),
+ (_("warning: %B: corrupt GNU_PROPERTY_TYPE (%ld) size: %#lx"),
abfd, note->type, note->descsz);
return FALSE;
}
if ((ptr + datasz) > ptr_end)
{
_bfd_error_handler
- (_("warning: %B: corrupt GNU_PROPERTY_TYPE (%ld) type (0x%x) datasz: 0x%x\n"),
+ (_("warning: %B: corrupt GNU_PROPERTY_TYPE (%ld) type (0x%x) datasz: 0x%x"),
abfd, note->type, type, datasz);
/* Clear all properties. */
elf_properties (abfd) = NULL;
if (datasz != align_size)
{
_bfd_error_handler
- (_("warning: %B: corrupt stack size: 0x%x\n"),
+ (_("warning: %B: corrupt stack size: 0x%x"),
abfd, datasz);
/* Clear all properties. */
elf_properties (abfd) = NULL;
if (datasz != 0)
{
_bfd_error_handler
- (_("warning: %B: corrupt no copy on protected size: 0x%x\n"),
+ (_("warning: %B: corrupt no copy on protected size: 0x%x"),
abfd, datasz);
/* Clear all properties. */
elf_properties (abfd) = NULL;
}
_bfd_error_handler
- (_("warning: %B: unsupported GNU_PROPERTY_TYPE (%ld) type: 0x%x\n"),
+ (_("warning: %B: unsupported GNU_PROPERTY_TYPE (%ld) type: 0x%x"),
abfd, note->type, type);
next:
with ABFD. */
static bfd_boolean
-elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
- elf_property *bprop)
+elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd,
+ elf_property *aprop, elf_property *bprop)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
if (bed->merge_gnu_properties != NULL
&& pr_type >= GNU_PROPERTY_LOPROC
&& pr_type < GNU_PROPERTY_LOUSER)
- return bed->merge_gnu_properties (abfd, aprop, bprop);
+ return bed->merge_gnu_properties (info, abfd, aprop, bprop);
switch (pr_type)
{
/* Merge GNU property list *LISTP with ABFD. */
static void
-elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
+elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *abfd,
+ elf_property_list **listp)
{
elf_property_list *p, **lastp;
elf_property *pr;
pr = elf_find_and_remove_property (listp, p->property.pr_type);
/* Pass NULL to elf_merge_gnu_properties for the property which
isn't on *LISTP. */
- elf_merge_gnu_properties (abfd, &p->property, pr);
+ elf_merge_gnu_properties (info, abfd, &p->property, pr);
if (p->property.pr_kind == property_remove)
{
/* Remove this property. */
/* Merge the remaining properties on *LISTP with ABFD. */
for (p = *listp; p != NULL; p = p->next)
- if (elf_merge_gnu_properties (abfd, NULL, &p->property))
+ if (elf_merge_gnu_properties (info, abfd, NULL, &p->property))
{
pr = _bfd_elf_get_property (abfd, p->property.pr_type,
p->property.pr_datasz);
}
}
-/* Set up GNU properties. */
+/* Set up GNU properties. Return the first relocatable ELF input with
+ GNU properties if found. Otherwise, return NULL. */
-void
+bfd *
_bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
{
bfd *abfd, *first_pbfd = NULL;
/* Find the first relocatable ELF input with GNU properties. */
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_count_sections (abfd) != 0
+ && (abfd->flags & DYNAMIC) == 0
&& elf_properties (abfd) != NULL)
{
has_properties = TRUE;
/* Do nothing if there is no .note.gnu.property section. */
if (!has_properties)
- return;
+ return NULL;
/* Merge .note.gnu.property sections. */
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
- if (abfd != first_pbfd && bfd_count_sections (abfd) != 0)
+ if (abfd != first_pbfd && (abfd->flags & DYNAMIC) == 0)
{
elf_property_list *null_ptr = NULL;
elf_property_list **listp = &null_ptr;
when all properties are from ELF objects with different
machine code or class. */
if (first_pbfd != NULL)
- elf_merge_gnu_property_list (first_pbfd, listp);
+ elf_merge_gnu_property_list (info, first_pbfd, listp);
if (list != NULL)
{
/* Discard .note.gnu.property section if all properties have
been removed. */
sec->output_section = bfd_abs_section_ptr;
- return;
+ return NULL;
}
/* Compute the section size. */
/* Cache the section contents for elf_link_input_bfd. */
elf_section_data (sec)->this_hdr.contents = contents;
}
+
+ return first_pbfd;
}