This is the mail archive of the binutils@sources.redhat.com 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]

Re: PATCH: Speed up AR for ELF


On Mon, May 02, 2005 at 11:41:55AM +0930, Alan Modra wrote:
> On Sat, Apr 30, 2005 at 12:36:55PM -0700, H. J. Lu wrote:
> > 	* elf.c (_bfd_elf_new_section_hook): Don't call
> > 	_bfd_elf_get_sec_type_attr on sections from input files.
> 
> What happens for linker created sections?

Shouldn't their output sections have the right section type and flags?

Here is the updated one.


H.J.
---
2005-05-01  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.input	2005-04-28 09:01:55.000000000 -0700
+++ bfd/elf.c	2005-05-01 19:31:20.000000000 -0700
@@ -2245,12 +2245,17 @@ _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)
+  /* When we read a file, we don't need 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) = ssect->type;
-      elf_section_flags (sec) = ssect->attr;
+      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.  */


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