diff options
author | Nick Clifton <nickc@redhat.com> | 2016-07-27 10:49:32 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2016-07-27 10:50:52 +0100 |
commit | 147d994bcdd36a177e49e7b6ac8d9c1f7b4cdcf5 (patch) | |
tree | 6dd71ad25f4b9e7a6518f8cb15fb3a31870c9017 /bfd/coffgen.c | |
parent | 7fca8e8ff70e53aeb5459cbe1438d168d5624958 (diff) | |
download | gdb-147d994bcdd36a177e49e7b6ac8d9c1f7b4cdcf5.zip gdb-147d994bcdd36a177e49e7b6ac8d9c1f7b4cdcf5.tar.gz gdb-147d994bcdd36a177e49e7b6ac8d9c1f7b4cdcf5.tar.bz2 |
Fix seg-fault when running garbage collection on coff binaries.
PR ld/20401
* coffgen.c (fini_reloc_cookie_rels): Check for the extistence
of the coff_section_data before using it.
Diffstat (limited to 'bfd/coffgen.c')
-rw-r--r-- | bfd/coffgen.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 56864ca..75512fb 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -2691,7 +2691,13 @@ static void fini_reloc_cookie_rels (struct coff_reloc_cookie *cookie, asection *sec) { - if (cookie->rels && coff_section_data (NULL, sec)->relocs != cookie->rels) + if (cookie->rels + /* PR 20401. The relocs may not have been cached, so check first. + If the relocs were loaded by init_reloc_cookie_rels() then this + will be the case. FIXME: Would performance be improved if the + relocs *were* cached ? */ + && coff_section_data (NULL, sec) + && coff_section_data (NULL, sec)->relocs != cookie->rels) free (cookie->rels); } |