public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Speed up AR for ELF
@ 2005-04-30 19:50 H. J. Lu
  0 siblings, 0 replies; only message in thread
From: H. J. Lu @ 2005-04-30 19:50 UTC (permalink / raw)
  To: binutils; +Cc: gcc

We are calling _bfd_elf_get_sec_type_attr on sections from input files.
It is not necessary at all. This patch should speed up AR for ELF.


H.J.
---
2005-04-30  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c (_bfd_elf_new_section_hook): Don't call
	_bfd_elf_get_sec_type_attr on sections from input files.

--- bfd/elf.c.speed	2005-04-29 23:30:28.000000000 -0700
+++ bfd/elf.c	2005-04-30 10:23:02.000000000 -0700
@@ -2251,12 +2251,18 @@ _bfd_elf_new_section_hook (bfd *abfd, as
       sec->used_by_bfd = sdata;
     }
 
-  elf_section_type (sec) = SHT_NULL;
-  ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name);
-  if (ssect != NULL)
-    {
-      elf_section_type (sec) = ssect->type;
-      elf_section_flags (sec) = ssect->attr;
+  /* When we read a file, we don't need to section type and flags.
+     They will be overridden in _bfd_elf_make_section_from_shdr
+     anyway.  */
+  if (abfd->direction != read_direction)
+    {
+      elf_section_type (sec) = SHT_NULL;
+      ssect = _bfd_elf_get_sec_type_attr (abfd, sec->name);
+      if (ssect != NULL)
+	{
+	  elf_section_type (sec) = ssect->type;
+	  elf_section_flags (sec) = ssect->attr;
+	}
     }
 
   /* Indicate whether or not this section should use RELA relocations.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-30 19:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-30 19:50 PATCH: Speed up AR for ELF H. J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).