This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Short circuit when copying ELF program header
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 23 Jan 2007 13:48:55 -0800
- Subject: 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;
+ }
}
}