[x86] Resolve non-PIC undefweak symbols in executable
[deliverable/binutils-gdb.git] / ld / emultempl / metagelf.em
index 7760f814bd4d73167989da308dcd745a4f1720d7..5626ecad83090eb1cb4e772fe9e335ac0d9b01cf 100644 (file)
@@ -1,5 +1,5 @@
 # This shell script emits a C file. -*- C -*-
-#   Copyright 2013 Free Software Foundation, Inc.
+#   Copyright (C) 2013-2016 Free Software Foundation, Inc.
 #
 # This file is part of GNU Binutils.
 #
@@ -45,9 +45,9 @@ static bfd_signed_vma group_size = 1;
 static void
 metagelf_create_output_section_statements (void)
 {
-  extern const bfd_target bfd_elf32_metag_vec;
+  extern const bfd_target metag_elf32_vec;
 
-  if (link_info.output_bfd->xvec != &bfd_elf32_metag_vec)
+  if (link_info.output_bfd->xvec != &metag_elf32_vec)
     return;
 
   stub_file = lang_add_input_file ("linker stubs",
@@ -219,20 +219,26 @@ build_section_lists (lang_statement_union_type *statement)
 static void
 gld${EMULATION_NAME}_after_allocation (void)
 {
+  int ret;
+
   /* bfd_elf_discard_info just plays with data and debugging sections,
      ie. doesn't affect code size, so we can delay resizing the
      sections.  It's likely we'll resize everything in the process of
      adding stubs.  */
-  if (bfd_elf_discard_info (link_info.output_bfd, &link_info))
+  ret = bfd_elf_discard_info (link_info.output_bfd, &link_info);
+  if (ret < 0)
+    {
+      einfo ("%X%P: .eh_frame/.stab edit: %E\n");
+      return;
+    }
+  else if (ret > 0)
     need_laying_out = 1;
 
   /* If generating a relocatable output file, then we don't
      have to examine the relocs.  */
-  if (stub_file != NULL && !link_info.relocatable)
+  if (stub_file != NULL && !bfd_link_relocatable (&link_info))
     {
-      int ret = elf_metag_setup_section_lists (link_info.output_bfd,
-                                              &link_info);
-
+      ret = elf_metag_setup_section_lists (link_info.output_bfd, &link_info);
       if (ret != 0)
        {
          if (ret < 0)
@@ -260,7 +266,7 @@ gld${EMULATION_NAME}_after_allocation (void)
   if (need_laying_out != -1)
     gld${EMULATION_NAME}_map_segments (need_laying_out);
 
-  if (! link_info.relocatable)
+  if (!bfd_link_relocatable (&link_info))
     {
       /* Now build the linker stubs.  */
       if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
This page took 0.025456 seconds and 4 git commands to generate.