PR24623, DWARF errors
[deliverable/binutils-gdb.git] / bfd / linker.c
index 9fee90d1010fb50eb1a418b88cec9090448e933b..edbd0a7df46901e016f43659ed6b6bdf588c560e 100644 (file)
@@ -1,5 +1,5 @@
 /* linker.c -- BFD linker routines
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-2019 Free Software Foundation, Inc.
    Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -959,7 +959,7 @@ _bfd_generic_link_add_archive_symbols
 
          if (arsym->name == NULL)
            goto error_return;
-                                 
+
          h = bfd_link_hash_lookup (info->hash, arsym->name,
                                    FALSE, FALSE, TRUE);
 
@@ -1421,12 +1421,24 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
   else if (bfd_is_com_section (section))
     {
       row = COMMON_ROW;
-      if (!bfd_link_relocatable (info)
-         && name[0] == '_'
-         && name[1] == '_'
-         && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
-       _bfd_error_handler
-         (_("%pB: plugin needed to handle lto object"), abfd);
+      static bfd_boolean report_plugin_err = TRUE;
+      if (!bfd_link_relocatable (info) && report_plugin_err)
+       {
+         if (abfd->lto_slim_object)
+           {
+             report_plugin_err = FALSE;
+             _bfd_error_handler
+               (_("%pB: plugin needed to handle lto object"), abfd);
+           }
+         else if (name[0] == '_'
+                  && name[1] == '_'
+                  && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
+           {
+             report_plugin_err = FALSE;
+             _bfd_error_handler
+               (_("%pB: plugin needed to handle lto object"), abfd);
+           }
+       }
     }
   else
     row = DEF_ROW;
@@ -2112,12 +2124,11 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
            }
        }
 
-      /* This switch is straight from the old code in
-        write_file_locals in ldsym.c.  */
-      if (info->strip == strip_all
-         || (info->strip == strip_some
-             && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
-                                 FALSE, FALSE) == NULL))
+      if ((sym->flags & BSF_KEEP) == 0
+         && (info->strip == strip_all
+             || (info->strip == strip_some
+                 && bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
+                                     FALSE, FALSE) == NULL)))
        output = FALSE;
       else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
        {
@@ -2131,6 +2142,8 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
          else
            output = FALSE;
        }
+      else if ((sym->flags & BSF_KEEP) != 0)
+       output = TRUE;
       else if (bfd_is_ind_section (sym->section))
        output = FALSE;
       else if ((sym->flags & BSF_DEBUGGING) != 0)
@@ -3119,7 +3132,7 @@ bfd_generic_define_common_symbol (bfd *output_bfd,
   /* Make sure the section is allocated in memory, and make sure that
      it is no longer a common section.  */
   section->flags |= SEC_ALLOC;
-  section->flags &= ~SEC_IS_COMMON;
+  section->flags &= ~(SEC_IS_COMMON | SEC_HAS_CONTENTS);
   return TRUE;
 }
 
This page took 0.02405 seconds and 4 git commands to generate.