Trim last, empty, line
[deliverable/binutils-gdb.git] / ld / plugin.c
index 5f4aa8faa6ab59d565111ed3633e2539b74dee67..7e3d2a33ba87075efe5fdd859171b803a7f1e8cd 100644 (file)
@@ -1,5 +1,5 @@
 /* Plugin control for the GNU linker.
-   Copyright 2010, 2011 Free Software Foundation, Inc.
+   Copyright 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This file is part of the GNU Binutils.
 
@@ -262,7 +262,7 @@ is_ir_dummy_bfd (const bfd *abfd)
      when processing DT_NEEDED dependencies.  */
   return (abfd
          && abfd->usrdata
-         && ((lang_input_statement_type *)(abfd->usrdata))->claimed);
+         && ((lang_input_statement_type *)(abfd->usrdata))->flags.claimed);
 }
 
 /* Helpers to convert between BFD and GOLD symbol formats.  */
@@ -697,7 +697,9 @@ set_tv_header (struct ld_plugin_tv *tv)
        case LDPT_LINKER_OUTPUT:
          TVU(val) = (link_info.relocatable
                      ? LDPO_REL
-                     : link_info.executable ? LDPO_EXEC : LDPO_DYN);
+                     : (link_info.executable
+                        ? (link_info.pie ? LDPO_PIE : LDPO_EXEC)
+                        : LDPO_DYN));
          break;
        case LDPT_OUTPUT_NAME:
          TVU(string) = output_filename;
@@ -873,7 +875,7 @@ plugin_maybe_claim (struct ld_plugin_input_file *file,
       if (entry->the_bfd->my_archive == NULL)
        bfd_close (entry->the_bfd);
       entry->the_bfd = file->handle;
-      entry->claimed = TRUE;
+      entry->flags.claimed = TRUE;
       bfd_make_readable (entry->the_bfd);
     }
   else
@@ -881,7 +883,7 @@ plugin_maybe_claim (struct ld_plugin_input_file *file,
       /* If plugin didn't claim the file, we don't need the dummy bfd.
         Can't avoid speculatively creating it, alas.  */
       bfd_close_all_done (file->handle);
-      entry->claimed = FALSE;
+      entry->flags.claimed = FALSE;
     }
 }
 
@@ -1014,3 +1016,14 @@ plugin_notice (struct bfd_link_info *info,
                                      abfd, section, value, flags, string);
   return TRUE;
 }
+
+/* Return true if bfd is a dynamic library that should be reloaded.  */
+
+bfd_boolean
+plugin_should_reload (bfd *abfd)
+{
+  return ((abfd->flags & DYNAMIC) != 0
+         && bfd_get_flavour (abfd) == bfd_target_elf_flavour
+         && bfd_get_format (abfd) == bfd_object
+         && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0);
+}
This page took 0.024785 seconds and 4 git commands to generate.