Don't assert at ldwrite.c:212

Alan Modra amodra@gmail.com
Wed Jul 29 08:12:38 GMT 2020


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.

diff --git a/ld/ldelf.c b/ld/ldelf.c
index 729239c101..75c6c015ae 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -2190,6 +2190,7 @@ ldelf_before_place_orphans (void)
 	      if (discarded_section (linked_to_sec))
 		{
 		  isec->output_section = bfd_abs_section_ptr;
+		  isec->flags |= SEC_EXCLUDE;
 		  break;
 		}
 	  }

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list