bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/20401] New: segfault in fini_reloc_cookie_rels() with --gc-secti


From: sezeroz at gmail dot com
Subject: [Bug ld/20401] New: segfault in fini_reloc_cookie_rels() with --gc-sections
Date: Fri, 22 Jul 2016 20:33:21 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20401

            Bug ID: 20401
           Summary: segfault in fini_reloc_cookie_rels() with
                    --gc-sections
           Product: binutils
           Version: 2.26
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: sezeroz at gmail dot com
  Target Milestone: ---

We ran into a segfault with the djgpp port of ld in fini_reloc_cookie_rels()
when --gc-sections is used.  It appears that coff_section_data (NULL, sec)
i.e. (sec)->used_by_bfd is NULL.  The issue seems to have started with the
git commit 0f088b2a.  My workaround is like the following:

diff -urNp binutils-2.26/bfd/coffgen.c.orig binutils-2.26/bfd/coffgen.c
--- binutils-2.26/bfd/coffgen.c.orig    2015-11-13 10:27:40.000000000 +0200
+++ binutils-2.26/bfd/coffgen.c 2016-07-22 11:41:02.000000000 +0300
@@ -2688,7 +2688,7 @@
 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 && (!coff_section_data (NULL, sec) || coff_section_data
(NULL, sec)->relocs != cookie->rels))
     free (cookie->rels);
 }


It is possible that this is a wrong way of fixing it.  The coff maintainers
surely would do it correctly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]