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]

[RFA] Fix an i386 ld test FAIL


This patch fixes "Invalid allocated section" test in ld/testsuite/ld-i386/i386.exp when testing ld on native i686-pc-linux-gnu.

This test case consumes all the 1G memory + 1G swap when testing on my 32bit i686 PC and finally times out.

For the section .foo in that test case, sec->vma == 0 and p->p_vaddr + p->p_memsz == 0xc0100008. So in the following statement:

bfd_signed_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);

adjust is 0x3feffff8 because we are doing 32bit calculation. Thus the expected "overlaps preious sections" error is not reported.

Regtested with native i686-pc-linux-gnu. Is this patch OK?


-- Jie Zhang CodeSourcery (650) 331-3385 x735
	* elf.c (assign_file_positions_for_load_sections): Avoid
	overflow.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.505
diff -u -p -r1.505 elf.c
--- bfd/elf.c	25 Feb 2010 03:49:14 -0000	1.505
+++ bfd/elf.c	17 Mar 2010 10:41:43 -0000
@@ -4452,7 +4452,7 @@ assign_file_positions_for_load_sections 
 	    {
 	      bfd_signed_vma adjust = sec->vma - (p->p_vaddr + p->p_memsz);
 
-	      if (adjust < 0)
+	      if (sec->vma < p->p_vaddr + p->p_memsz)
 		{
 		  (*_bfd_error_handler)
 		    (_("%B: section %A vma 0x%lx overlaps previous sections"),

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