[binutils-gdb/binutils-2_35-branch] Don't assert at ldwrite.c:212

Alan Modra amodra@sourceware.org
Fri Jan 29 22:49:54 GMT 2021


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

commit 9107f37953b565a7604a4d89b8f2bf5b07a0279b
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Jul 29 17:30:15 2020 +0930

    Don't assert at ldwrite.c:212
    
    When excluding SHF_LINK_ORDER sections that happen to have SEC_KEEP
    set, we need to set SEC_EXCLUDE here to avoid a problem later.
    
            * ldelf.c (ldelf_before_place_orphans): Set SEC_EXCLUDE for
            discarded sections.
    
    (cherry picked from commit 5987401fcbc9933808fa0d84d1b01c93356c39a1)

Diff:
---
 ld/ChangeLog | 7 +++++++
 ld/ldelf.c   | 1 +
 2 files changed, 8 insertions(+)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index d8abc62717c..e9374b46335 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2021-01-30  Alan Modra  <amodra@gmail.com>
+
+	Apply from master
+	2020-07-29  Alan Modra  <amodra@gmail.com>
+	* ldelf.c (ldelf_before_place_orphans): Set SEC_EXCLUDE for
+	discarded sections.
+
 2021-01-01  Alan Modra  <amodra@gmail.com>
 
 	Apply from master
diff --git a/ld/ldelf.c b/ld/ldelf.c
index 831d032fe56..bcac331ff56 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -2192,6 +2192,7 @@ ldelf_before_place_orphans (void)
 	      if (discarded_section (linked_to_sec))
 		{
 		  isec->output_section = bfd_abs_section_ptr;
+		  isec->flags |= SEC_EXCLUDE;
 		  break;
 		}
 	  }


More information about the Binutils-cvs mailing list