Large lma delta using binutils 2.19

James Blackburn james.blackburn@broadcom.com
Wed Mar 3 11:30:00 GMT 2010


On 03/03/2010 02:57, Alan Modra wrote:
> If you're unwilling to fix the test scripts so that they work with
> both old and new ld, then your best option may be to not update ld or
> to create your own custom ld.  I don't think we should contemplate
> changing the default back;  The new behaviour has been in GNU ld for
> over three and a half years.

I agree that the new default is better (and also that we're significantly behind the curve:) )!

However the thing I'm still failing to see why the increment is the last section's vma/lma delta.  Just like users have the expectation that unspecified VMAs follow on from the previous, shouldn't the same be true for the lma?

I'm trying to avoid the very large gap this change causes, and from a first glance I can't see why we can't just make the lma follow on from the previous section's phys addr end.  The attached patch doesn't break any tests in my 2.19.1 port.

Am I missing something?

Cheers,
James

Index: ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.332
diff -u -r1.332 ldlang.c
--- ldlang.c	25 Feb 2010 03:49:15 -0000	1.332
+++ ldlang.c	3 Mar 2010 11:26:10 -0000
@@ -4896,15 +4896,12 @@
  		  }
  		else
  		  {
-		    /* If this is an overlay, set the current lma to that
-		       at the end of the previous section.  */
-		    if (os->sectype == overlay_section)
-		      lma = last->lma + last->size;
-
-		    /* Otherwise, keep the same lma to vma relationship
-		       as the previous section.  */
-		    else
-		      lma = dot + last->lma - last->vma;
+                    if (os->sectype != overlay_section && last->lma - last->vma == 0)
+                      /* If the previous section had default lma == vma, this does too */
+                      lma = dot;
+                    else
+                      /* Otherwise, put this section at the end of the last.  */
+                      lma = last->lma + last->size;
  
  		    if (os->section_alignment != -1)
  		      lma = align_power (lma, os->section_alignment);



More information about the Binutils mailing list