diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-25 16:15:27 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-25 23:07:10 +0930 |
commit | a93ba4c0cf1d6ffa46b493643460730265455e4c (patch) | |
tree | 8d4b496712456c53772e578ea82fdc407e14561a | |
parent | 1438dd86cc7b1048a8d1b37754d51d9153123064 (diff) | |
download | gdb-a93ba4c0cf1d6ffa46b493643460730265455e4c.zip gdb-a93ba4c0cf1d6ffa46b493643460730265455e4c.tar.gz gdb-a93ba4c0cf1d6ffa46b493643460730265455e4c.tar.bz2 |
PR26482, ASAN: _bfd_xcoff_sizeof_headers coff-rs6000.c:2585
PR 26482
* coff-rs6000.c (_bfd_xcoff_sizeof_headers): Ignore sections that
won't be output.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/coff-rs6000.c | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7cf99f6..c3342ca 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 2020-08-25 Alan Modra <amodra@gmail.com> + PR 26482 + * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Ignore sections that + won't be output. + +2020-08-25 Alan Modra <amodra@gmail.com> + PR 26463 * elf32-m32c.c (m32c_elf_relax_section): Check is_elf_hash_table before accessing elf fields. diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 00c9d7c..48c583b 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -2580,11 +2580,13 @@ _bfd_xcoff_sizeof_headers (bfd *abfd, /* Sum. */ for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) for (s = sub->sections; s != NULL; s = s->next) - { - struct nbr_reloc_lineno *e = &n_rl[s->output_section->index]; - e->reloc_count += s->reloc_count; - e->lineno_count += s->lineno_count; - } + if (s->output_section->owner == abfd + && !bfd_section_removed_from_list (abfd, s->output_section)) + { + struct nbr_reloc_lineno *e = &n_rl[s->output_section->index]; + e->reloc_count += s->reloc_count; + e->lineno_count += s->lineno_count; + } /* Add the size of a section for each section with an overflow. */ for (s = abfd->sections; s != NULL; s = s->next) |