This is the mail archive of the binutils-cvs@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]

[binutils-gdb] Fix seg-fault linking corrupt binary.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=68c638d6e655a937a48770a5df765e6ebbc5b890

commit 68c638d6e655a937a48770a5df765e6ebbc5b890
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Dec 2 14:40:46 2016 +0000

    Fix seg-fault linking corrupt binary.
    
    	PR ld/20912
    	* emultempl/elf32.em (_place_orphan): Test for ELF format of the
    	orphan before looking for the SHF_EXCLUDE flag.

Diff:
---
 ld/ChangeLog          | 6 ++++++
 ld/emultempl/elf32.em | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index c4bbe55..e9734ac 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-02  Nick Clifton  <nickc@redhat.com>
+
+	PR ld/20912
+	* emultempl/elf32.em (_place_orphan): Test for ELF format of the
+	orphan before looking for the SHF_EXCLUDE flag.
+
 2016-12-02  Josh Conner  <joshconner@google.com>
 
         * Makefile.am: Add dependency information for earmelf_fuchsia.c.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 36aa7db..1fd6313 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2062,9 +2062,9 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
 	if (os->bfd_section != NULL
 	    && (os->bfd_section->flags == 0
 		|| ((!bfd_link_relocatable (&link_info)
-		     || (((elf_section_flags (s)
-			  ^ elf_section_flags (os->bfd_section))
-			 & SHF_EXCLUDE) == 0))
+		     || (iself && (((elf_section_flags (s)
+				     ^ elf_section_flags (os->bfd_section))
+				    & SHF_EXCLUDE) == 0)))
 		    && ((s->flags ^ os->bfd_section->flags)
 		     & (SEC_LOAD | SEC_ALLOC)) == 0
 		    && _bfd_elf_match_sections_by_type (link_info.output_bfd,


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