Don't assert at ldwrite.c:212
authorAlan Modra <amodra@gmail.com>
Wed, 29 Jul 2020 08:00:15 +0000 (17:30 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 29 Jul 2020 08:08:01 +0000 (17:38 +0930)
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.

ld/ChangeLog
ld/ldelf.c

index 9cee3ca275bbda8659fcd8379937f830b78cb1b4..5ee1a0ea55d0842d002c7ba426ca332f9b5495c0 100644 (file)
@@ -1,3 +1,8 @@
+2020-07-29  Alan Modra  <amodra@gmail.com>
+
+       * ldelf.c (ldelf_before_place_orphans): Set SEC_EXCLUDE for
+       discarded sections.
+
 2020-07-28  Alan Modra  <amodra@gmail.com>
 
        * ldlang.c (lang_check): Don't complain about relocs or merge
index 729239c101e1ba83a7423456f0b2315a5f2f3dd2..75c6c015aee8002e6f744adc5b9b261ad7163147 100644 (file)
@@ -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;
                }
          }