X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Felf-properties.c;h=21bb0716e78f3fc1a96788e8f57670824ed3aa1e;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=0c3f19ce56a36bb18d9afd2e140d735eeaf9c6a9;hpb=cd702818c6cf25277253b3b5c23f17d2cf7a94df;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c index 0c3f19ce56..21bb0716e7 100644 --- a/bfd/elf-properties.c +++ b/bfd/elf-properties.c @@ -1,5 +1,5 @@ /* ELF program property support. - Copyright (C) 2017-2019 Free Software Foundation, Inc. + Copyright (C) 2017-2020 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -86,7 +86,7 @@ _bfd_elf_parse_gnu_properties (bfd *abfd, Elf_Internal_Note *note) if (note->descsz < 8 || (note->descsz % align_size) != 0) { -bad_size: + bad_size: _bfd_error_handler (_("warning: %pB: corrupt GNU_PROPERTY_TYPE (%ld) size: %#lx"), abfd, note->type, note->descsz); @@ -186,7 +186,7 @@ bad_size: (_("warning: %pB: unsupported GNU_PROPERTY_TYPE (%ld) type: 0x%x"), abfd, note->type, type); -next: + next: ptr += (datasz + (align_size - 1)) & ~ (align_size - 1); } @@ -198,7 +198,7 @@ next: 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); @@ -207,7 +207,7 @@ elf_merge_gnu_properties (struct bfd_link_info *info, bfd *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) { @@ -236,12 +236,12 @@ elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd, 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; @@ -250,7 +250,7 @@ elf_find_and_remove_property (elf_property_list **listp, if (type == list->property.pr_type) { /* Remove this property. */ - if (remove) + if (rm) *listp = list->next; return &list->property; } @@ -289,7 +289,7 @@ elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *first_pbfd, 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) @@ -322,12 +322,10 @@ elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *first_pbfd, (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) { @@ -365,7 +363,7 @@ elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *first_pbfd, 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; @@ -697,14 +695,16 @@ _bfd_elf_convert_gnu_properties (bfd *ibfd, asection *isec, 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); + if (contents == NULL) + return FALSE; free (*ptr); *ptr = contents; }