gdb/23712: Test case for multidictionary
[deliverable/binutils-gdb.git] / ld / emultempl / mmo.em
index b895a9aaf128719e60a8ae77a8367e0ea0d61fdc..0a25851722db79dd79f6a2748528fdbc085de539 100644 (file)
@@ -1,6 +1,5 @@
 # This shell script emits a C file. -*- C -*-
-#   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
-#   Free Software Foundation, Inc.
+#   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
 #
@@ -89,10 +88,12 @@ mmo_place_orphan (asection *s,
   lang_output_section_statement_type *after;
   lang_output_section_statement_type *os;
   size_t i;
+  flagword flags;
+  asection *nexts;
 
   /* We have nothing to say for anything other than a final link or
      for sections that are excluded.  */
-  if (link_info.relocatable
+  if (bfd_link_relocatable (&link_info)
       || (s->flags & SEC_EXCLUDE) != 0)
     return NULL;
 
@@ -106,13 +107,31 @@ mmo_place_orphan (asection *s,
       return os;
     }
 
+  flags = s->flags;
+  if (!bfd_link_relocatable (&link_info))
+    {
+      nexts = s;
+      while ((nexts = bfd_get_next_section_by_name (nexts->owner, nexts))
+            != NULL)
+       if (nexts->output_section == NULL
+           && (nexts->flags & SEC_EXCLUDE) == 0
+           && ((nexts->flags ^ flags) & (SEC_LOAD | SEC_ALLOC)) == 0
+           && (nexts->owner->flags & DYNAMIC) == 0
+           && nexts->owner->usrdata != NULL
+           && !(((lang_input_statement_type *) nexts->owner->usrdata)
+                ->flags.just_syms))
+         flags = (((flags ^ SEC_READONLY) | (nexts->flags ^ SEC_READONLY))
+                  ^ SEC_READONLY);
+    }
+
   /* Check for matching section type flags for sections we care about.
      A section without contents can have SEC_LOAD == 0, but we still
      want it attached to a sane section so the symbols appear as
      expected.  */
-  if ((s->flags & (SEC_ALLOC | SEC_READONLY)) != SEC_READONLY)
+
+  if ((flags & (SEC_ALLOC | SEC_READONLY)) != SEC_READONLY)
     for (i = 0; i < sizeof (holds) / sizeof (holds[0]); i++)
-      if ((s->flags & holds[i].nonzero_flags) != 0)
+      if ((flags & holds[i].nonzero_flags) != 0)
        {
          place = &holds[i].orphansave;
          if (place->os == NULL)
@@ -209,7 +228,7 @@ mmo_after_open (void)
        {
          if (bfd_get_flavour (is->the_bfd) == bfd_target_elf_flavour
              && !_bfd_mmix_check_all_relocs (is->the_bfd, &link_info))
-           einfo ("%X%P: Internal problems scanning %B after opening it",
+           einfo (_("%X%P: internal problems scanning %pB after opening it"),
                   is->the_bfd);
        }
     }
This page took 0.02424 seconds and 4 git commands to generate.