Strange LMA/VMA behavior with regions

Alan Modra amodra@gmail.com
Fri May 13 05:26:00 GMT 2011


On Fri, May 13, 2011 at 09:44:43AM +0530, Anitha Boyapati wrote:
> In the process of verifying further, I have changed the linker script
> by removing 'AT>' , still same output is observed.
> 
>   1 .text_os      00000008  80000008  80000002  00000408  2**3
>                   CONTENTS, ALLOC, LOAD, READONLY, CODE
> 
> I am not specifying any LMA in this case but still I get the current
> location for the LMA (Is this also expected?)

Now this probably is a bug, introduced by
http://sourceware.org/ml/binutils/2009-04/msg00068.html
Fix as follows.

	* ldlang.c (lang_leave_output_section_statement): Don't copy
	previous lma_region if given address.

Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.367
diff -u -p -r1.367 ldlang.c
--- ld/ldlang.c	3 May 2011 14:56:14 -0000	1.367
+++ ld/ldlang.c	13 May 2011 05:23:40 -0000
@@ -6912,11 +6912,13 @@ lang_leave_output_section_statement (fil
 		    current_section->load_base != NULL,
 		    current_section->addr_tree != NULL);
 
-  /* If this section has no load region or base, but has the same
+  /* If this section has no load region or base, but uses the same
      region as the previous section, then propagate the previous
      section's load region.  */
 
-  if (!current_section->lma_region && !current_section->load_base
+  if (current_section->lma_region == NULL
+      && current_section->load_base == NULL
+      && current_section->addr_tree == NULL
       && current_section->region == current_section->prev->region)
     current_section->lma_region = current_section->prev->lma_region;
 
-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list