aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-03-24 13:35:53 +0000
committerNick Clifton <nickc@redhat.com>2020-03-24 13:35:53 +0000
commitec2e748ad396c868839c977aa27d0333eb085970 (patch)
tree541c375a5a7d59607a8615badfccbc34dde593dc /bfd/elf.c
parentcda7e5603f6efd7c3716e45cc6ea11b70dd8daae (diff)
downloadgdb-ec2e748ad396c868839c977aa27d0333eb085970.zip
gdb-ec2e748ad396c868839c977aa27d0333eb085970.tar.gz
gdb-ec2e748ad396c868839c977aa27d0333eb085970.tar.bz2
Fix assertion failure in the BFD library when linking with --emit-relocs enabled.
PR 25681 * elf.c (_bfd_elf_map_sections_to_segments): When looking for a segment to use for PT_GNU_RELRO, ignore empty sections in a segment's current list.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 1004809..f5354d2 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5213,9 +5213,12 @@ _bfd_elf_map_sections_to_segments (bfd *abfd, struct bfd_link_info *info)
{
i = m->count;
while (--i != (unsigned) -1)
- if ((m->sections[i]->flags & (SEC_LOAD | SEC_HAS_CONTENTS))
- == (SEC_LOAD | SEC_HAS_CONTENTS))
- break;
+ {
+ if (m->sections[i]->size > 0
+ && (m->sections[i]->flags & (SEC_LOAD | SEC_HAS_CONTENTS))
+ == (SEC_LOAD | SEC_HAS_CONTENTS))
+ break;
+ }
if (i != (unsigned) -1)
break;