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]

PATCH: Short circuit when copying ELF program header


When we copy sections in a segment, we can stop when all sections
in a segment are ccounted for.

H.J.
----
2007-01-23  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c (copy_elf_program_header): Stop when all sections in
	a segment are ccounted for.

--- bfd/elf.c.speed	2007-01-23 13:02:48.000000000 -0800
+++ bfd/elf.c	2007-01-23 13:43:31.000000000 -0800
@@ -6039,7 +6039,11 @@ copy_elf_program_header (bfd *ibfd, bfd 
 	    {
 	      this_hdr = &(elf_section_data(section)->this_hdr);
 	      if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
-		map->sections[isec++] = section->output_section;
+		{
+		  map->sections[isec++] = section->output_section;
+		  if (isec == section_count)
+		    break;
+		}
 	    }
 	}
 


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