Revert readelf sorted PT_LOAD header check

Alan Modra amodra@gmail.com
Wed Nov 30 06:46:00 GMT 2016


This fixes a couple of test failures.  OK Nick?

FAIL: ld-elf/loadaddr1
FAIL: PHDRS headers 3a

Both with the following ld.log
exited abnormally with 0, output:readelf: Error: LOAD segments must be sorted in order of increasing VirtAddr


	PR ld/20815
	* readelf.c (process_program_headers): Don't check PT_LOAD p_vaddr.

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 347b6b9..09a3a11 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -4909,9 +4909,6 @@ process_program_headers (FILE * file)
       switch (segment->p_type)
 	{
 	case PT_LOAD:
-	  if (previous_load
-	      && previous_load->p_vaddr > segment->p_vaddr)
-	    error (_("LOAD segments must be sorted in order of increasing VirtAddr\n"));
 	  if (segment->p_memsz < segment->p_filesz)
 	    error (_("the segment's file size is larger than its memory size\n"));
 	  previous_load = segment;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list