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] Skip ELF section header check if not needed


When placing an orpha input section, there is no need to check for ELF
section header if either input or output isn't ELF.

OK for master?

H.J.
---
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Skip
	ELF section header check if either input or output isn't ELF.
---
 ld/emultempl/elf32.em | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 75ded127f3..3a0404c61b 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2095,6 +2095,8 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
     }
 
   if (!bfd_link_relocatable (&link_info)
+      && iself
+      && link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
       && (s->flags & SEC_ALLOC) != 0
       && (elf_section_flags (s) & SHF_GNU_MBIND) != 0)
     {
@@ -2137,6 +2139,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
 
   /* Look through the script to see where to place this section.  */
   if (constraint == 0
+      && iself
       && link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour)
     for (os = lang_output_section_find (secname);
 	 os != NULL;
@@ -2155,11 +2158,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
 		== elf_section_data (s)->this_hdr.sh_info)
 	    && (os->bfd_section->flags == 0
 		|| ((!bfd_link_relocatable (&link_info)
-		     || (iself && (((elf_section_flags (s)
-				     ^ elf_section_flags (os->bfd_section))
-				    & SHF_EXCLUDE) == 0)))
+		     || (((elf_section_flags (s)
+			   ^ elf_section_flags (os->bfd_section))
+			  & SHF_EXCLUDE) == 0))
 		    && ((s->flags ^ os->bfd_section->flags)
-		     & (SEC_LOAD | SEC_ALLOC)) == 0
+			& (SEC_LOAD | SEC_ALLOC)) == 0
 		    && _bfd_elf_match_sections_by_type (link_info.output_bfd,
 							os->bfd_section,
 							s->owner, s))))
-- 
2.13.3


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