aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-11-20 15:32:55 +0000
committerNick Clifton <nickc@redhat.com>2017-11-20 15:32:55 +0000
commitb77db948f4175e479bb3310ba86346c9554ab9f5 (patch)
tree634d70cd1221d48fa76e2f56c0c6836022e72c2c /bfd
parentb7486a74a62527412cfd2dd50a9a100118265c28 (diff)
downloadgdb-b77db948f4175e479bb3310ba86346c9554ab9f5.zip
gdb-b77db948f4175e479bb3310ba86346c9554ab9f5.tar.gz
gdb-b77db948f4175e479bb3310ba86346c9554ab9f5.tar.bz2
Fix handling of GNU Property notes that are not in a GNU NOTE PROPERTY section.
PR 22450 gas * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Skip objects without a GNU_PROPERTY note section when looking for a bfd onto which notes can be accumulated. ld * testsuite/ld-elf/elf.exp: Add --defsym ALIGN=2|3 to assembler command line depending upon the size of the target address space. * testsuite/ld-elf/pr22450.s: New test file. * testsuite/ld-elf/pr22450.d: New test driver. * testsuite/config/default.exp: Add note that LD_CLASS refers to the size of the host linker not the size of the target linker.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf-properties.c14
2 files changed, 17 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6e148b0..5bf4f1a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2017-11-20 Nick Clifton <nickc@redhat.com>
+
+ PR 22450
+ * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Skip
+ objects without a GNU_PROPERTY note section when looking for a bfd
+ onto which notes can be accumulated.
+
2017-11-20 Alan Modra <amodra@gmail.com>
PR 22451
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index bfb106e..32e03de 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -328,11 +328,15 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
has_properties = TRUE;
/* Ignore GNU properties from ELF objects with different machine
- code or class. */
+ code or class. Also skip objects without a GNU_PROPERTY note
+ section. */
if ((elf_machine_code
== get_elf_backend_data (abfd)->elf_machine_code)
&& (elfclass
- == get_elf_backend_data (abfd)->s->elfclass))
+ == get_elf_backend_data (abfd)->s->elfclass)
+ && bfd_get_section_by_name (abfd,
+ NOTE_GNU_PROPERTY_SECTION_NAME) != NULL
+ )
{
/* Keep .note.gnu.property section in FIRST_PBFD. */
first_pbfd = abfd;
@@ -374,10 +378,11 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
if (list != NULL)
{
- /* Discard .note.gnu.property section in the rest inputs. */
+ /* Discard the .note.gnu.property section in this bfd. */
sec = bfd_get_section_by_name (abfd,
NOTE_GNU_PROPERTY_SECTION_NAME);
- sec->output_section = bfd_abs_section_ptr;
+ if (sec != NULL)
+ sec->output_section = bfd_abs_section_ptr;
}
}
@@ -393,6 +398,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
sec = bfd_get_section_by_name (first_pbfd,
NOTE_GNU_PROPERTY_SECTION_NAME);
+ BFD_ASSERT (sec != NULL);
/* Update stack size in .note.gnu.property with -z stack-size=N
if N > 0. */