p_vaddr_offset should affect p_offset

Alan Modra amodra@gmail.com
Mon Aug 2 10:09:00 GMT 2010


This patch effectively subtracts m->p_vaddr_offset from p_offset, so
all of p_vaddr, p_paddr and p_offset are now affected by
p_vaddr_offset.  This fixes the bug triggered by the testcase in
PR 11866.

	PR 11866
	* elf.c (assign_file_positions_for_load_sections): Use p_vaddr to
	calculate off_adjust rather than first section vma.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.513
diff -u -p -r1.513 elf.c
--- bfd/elf.c	20 Jul 2010 14:08:31 -0000	1.513
+++ bfd/elf.c	2 Aug 2010 07:36:42 -0000
@@ -4337,7 +4334,7 @@ assign_file_positions_for_load_sections 
 		break;
 	      }
 
-	  off_adjust = vma_page_aligned_bias (m->sections[0]->vma, off, align);
+	  off_adjust = vma_page_aligned_bias (p->p_vaddr, off, align);
 	  off += off_adjust;
 	  if (no_contents)
 	    {

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list