This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/12380: Assertion in linker script failed twice


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]