bug-binutils
[Top][All Lists]
Advanced

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

ld (bfd) bug: discarded N_EXCL stab in repeated link [PATCH]


From: Mattias Engdegård
Subject: ld (bfd) bug: discarded N_EXCL stab in repeated link [PATCH]
Date: Tue, 16 Mar 2004 19:09:29 +0100

Sometimes ld throws away N_EXCL stabs found in the input file.
This can occur when the input file is the result of a (partial) link.
I ran into this bug when linking the Linux kernel.

When a repeated include file is excluded, then the N_BINCL stab is
changed to N_EXCL, and all the contained stabs up to and including the
corresponding N_EINCL stab are removed. The bug is here that an N_EXCL
stab (mark of a file that was excluded in a previous link) is also
removed. This is always an error --- N_EXCL stabs must remain untouched
in order for the include file number in stab types to be correct.

I have a testcase which I can wrap up if anyone is interested (and gdb
complains when being fed the result).

The following patch (apply to mainline) fixes it:

--- stabs.c.old Tue Mar 16 18:50:32 2004
+++ stabs.c     Tue Mar 16 18:50:44 2004
@@ -456,6 +456,8 @@
                    }
                  else if (incl_type == (int) N_BINCL)
                    ++nest;
+                  else if (incl_type == (int) N_EXCL)
+                    continue;   /* keep existing exclusion marks */
                  else if (nest == 0)
                    {
                      *incl_pstridx = (bfd_size_type) -1;

Someone, please apply.

(I submitted a patch for a related bug recently. This problem is orthogonal
but I should have caught it at the same time; sorry about that.)





reply via email to

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