* ld/ldlang.c (insert_pad): Change alignment_needed argument to
[deliverable/binutils-gdb.git] / ld / ldlang.c
index 3e63eedd409a9bf2fc0865a18626533922d118e2..4b9eae7ac050daef51989d6412f326b9a8cac8d7 100644 (file)
@@ -1133,6 +1133,7 @@ new_afile (const char *name,
 #ifdef ENABLE_PLUGINS
   p->claimed = FALSE;
   p->claim_archive = FALSE;
+  p->reload = FALSE;
 #endif /* ENABLE_PLUGINS */
 
   lang_statement_append (&input_file_chain,
@@ -2240,12 +2241,7 @@ section_already_linked (bfd *abfd, asection *sec, void *data)
     }
 
   if (!(abfd->flags & DYNAMIC))
-    {
-      struct already_linked linked;
-      linked.comdat_key = NULL;
-      linked.u.sec = sec;
-      bfd_section_already_linked (abfd, &linked, &link_info);
-    }
+    bfd_section_already_linked (abfd, sec, &link_info);
 }
 \f
 /* The wild routines.
@@ -2785,7 +2781,10 @@ load_symbols (lang_input_statement_type *entry,
       break;
 
     case bfd_object:
-      ldlang_add_file (entry);
+#ifdef ENABLE_PLUGINS
+      if (!entry->reload)
+#endif
+       ldlang_add_file (entry);
       if (trace_files || trace_file_tries)
        info_msg ("%I\n", entry);
       break;
@@ -3052,7 +3051,7 @@ lang_get_output_target (void)
 
   /* No - has the current target been set to something other than
      the default?  */
-  if (current_target != default_target)
+  if (current_target != default_target && current_target != NULL)
     return current_target;
 
   /* No - can we determine the format of the first input file?  */
@@ -3277,6 +3276,19 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
                  && bfd_check_format (s->input_statement.the_bfd,
                                       bfd_archive))
                s->input_statement.loaded = FALSE;
+#ifdef ENABLE_PLUGINS
+             /* When rescanning, reload --as-needed shared libs.  */
+             else if ((mode & OPEN_BFD_RESCAN) != 0
+                      && plugin_insert == NULL
+                      && s->input_statement.loaded
+                      && s->input_statement.add_DT_NEEDED_for_regular
+                      && ((s->input_statement.the_bfd->flags) & DYNAMIC) != 0
+                      && plugin_should_reload (s->input_statement.the_bfd))
+               {
+                 s->input_statement.loaded = FALSE;
+                 s->input_statement.reload = TRUE;
+               }
+#endif
 
              os_tail = lang_output_section_statement.tail;
              lang_list_init (&add);
@@ -4584,7 +4596,7 @@ dprint_statement (lang_statement_union_type *s, int n)
 static void
 insert_pad (lang_statement_union_type **ptr,
            fill_type *fill,
-           unsigned int alignment_needed,
+           bfd_size_type alignment_needed,
            asection *output_section,
            bfd_vma dot)
 {
@@ -4639,7 +4651,7 @@ size_input_section
   if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
       && (i->flags & SEC_EXCLUDE) == 0)
     {
-      unsigned int alignment_needed;
+      bfd_size_type alignment_needed;
       asection *o;
 
       /* Align this section first to the input sections requirement,
@@ -7463,10 +7475,6 @@ lang_leave_overlay (etree_type *lma_expr,
 \f
 /* Version handling.  This is only useful for ELF.  */
 
-/* This global variable holds the version tree that we build.  */
-
-struct bfd_elf_version_tree *lang_elf_version_info;
-
 /* If PREV is NULL, return first version pattern matching particular symbol.
    If PREV is non-NULL, return first version pattern matching particular
    symbol after PREV (previously returned by lang_vers_match).  */
@@ -7808,8 +7816,8 @@ lang_register_vers_node (const char *name,
   if (name == NULL)
     name = "";
 
-  if ((name[0] == '\0' && lang_elf_version_info != NULL)
-      || (lang_elf_version_info && lang_elf_version_info->name[0] == '\0'))
+  if (link_info.version_info != NULL
+      && (name[0] == '\0' || link_info.version_info->name[0] == '\0'))
     {
       einfo (_("%X%P: anonymous version tag cannot be combined"
               " with other version tags\n"));
@@ -7818,7 +7826,7 @@ lang_register_vers_node (const char *name,
     }
 
   /* Make sure this node has a unique name.  */
-  for (t = lang_elf_version_info; t != NULL; t = t->next)
+  for (t = link_info.version_info; t != NULL; t = t->next)
     if (strcmp (t->name, name) == 0)
       einfo (_("%X%P: duplicate version tag `%s'\n"), name);
 
@@ -7830,7 +7838,7 @@ lang_register_vers_node (const char *name,
 
   for (e1 = version->globals.list; e1 != NULL; e1 = e1->next)
     {
-      for (t = lang_elf_version_info; t != NULL; t = t->next)
+      for (t = link_info.version_info; t != NULL; t = t->next)
        {
          struct bfd_elf_version_expr *e2;
 
@@ -7857,7 +7865,7 @@ lang_register_vers_node (const char *name,
 
   for (e1 = version->locals.list; e1 != NULL; e1 = e1->next)
     {
-      for (t = lang_elf_version_info; t != NULL; t = t->next)
+      for (t = link_info.version_info; t != NULL; t = t->next)
        {
          struct bfd_elf_version_expr *e2;
 
@@ -7893,7 +7901,7 @@ lang_register_vers_node (const char *name,
   else
     version->vernum = 0;
 
-  for (pp = &lang_elf_version_info; *pp != NULL; pp = &(*pp)->next)
+  for (pp = &link_info.version_info; *pp != NULL; pp = &(*pp)->next)
     ;
   *pp = version;
 }
@@ -7909,7 +7917,7 @@ lang_add_vers_depend (struct bfd_elf_version_deps *list, const char *name)
   ret = (struct bfd_elf_version_deps *) xmalloc (sizeof *ret);
   ret->next = list;
 
-  for (t = lang_elf_version_info; t != NULL; t = t->next)
+  for (t = link_info.version_info; t != NULL; t = t->next)
     {
       if (strcmp (t->name, name) == 0)
        {
This page took 0.080141 seconds and 4 git commands to generate.