This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/12380: Assertion in linker script failed twice
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 11 Jan 2011 11:57:59 +1030
- Subject: Re: PATCH: PR ld/12380: Assertion in linker script failed twice
- References: <20110109180612.GA24309@intel.com>
On Sun, Jan 09, 2011 at 10:06:12AM -0800, H.J. Lu wrote:
> Hi,
>
> This patch avoids duplicated assert messages. OK to install?
This is not the correct fix. The reason we get duplicate messages is
that relaxation and ELF section header sizing cause multiple
iterations of section sizing/placement. Since an assert can be based
on section size and/or address, the assert you want is the one from
the *last* pass, not the first one as you have in your patch.
I believe the real problem is that we set lang_final_phase too soon,
so something like the following untested patch should work.
* ldlang.c (lang_size_sections): Don't set final phase here.
(lang_process): Do so here, just before lang_do_assignments.
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.355
diff -u -p -r1.355 ldlang.c
--- ld/ldlang.c 20 Dec 2010 13:00:13 -0000 1.355
+++ ld/ldlang.c 11 Jan 2011 01:23:55 -0000
@@ -5427,8 +5427,6 @@ lang_size_sections (bfd_boolean *relax,
one_lang_size_sections_pass (relax, check_regions);
}
}
-
- expld.phase = lang_final_phase_enum;
}
/* Worker function for lang_do_assignments. Recursiveness goes here. */
@@ -6522,6 +6520,7 @@ lang_process (void)
/* Do all the assignments, now that we know the final resting places
of all the symbols. */
+ expld.phase = lang_final_phase_enum;
lang_do_assignments ();
ldemul_finish ();
--
Alan Modra
Australia Development Lab, IBM