aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/ldfile.c5
-rw-r--r--ld/ldlang.c1
-rw-r--r--ld/ldlang.h3
-rw-r--r--ld/plugin.c16
5 files changed, 29 insertions, 5 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c30426d..4803ec3 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2015-02-14 Alan Modra <amodra@gmail.com>
+
+ PR ld/17973
+ * ldlang.h (struct lang_input_statement_flags): Add lto_output.
+ * ldlang.c (lang_process): Don't set loading_lto_outputs.
+ * ldfile.c (ldfile_try_open_bfd): Transfer entry flags.lto_output
+ to bfd.
+ * plugin.c (add_input_file, add_input_library): Set flags.lto_output.
+
2015-02-13 H.J. Lu <hongjiu.lu@intel.com>
* NEWS: Mention support for LLVM plugin.
diff --git a/ld/ldfile.c b/ld/ldfile.c
index e19f55e..21bdbf4 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -142,6 +142,11 @@ ldfile_try_open_bfd (const char *attempt,
/* Linker needs to decompress sections. */
entry->the_bfd->flags |= BFD_DECOMPRESS;
+#ifdef ENABLE_PLUGINS
+ if (entry->flags.lto_output)
+ entry->the_bfd->lto_output = 1;
+#endif
+
/* If we are searching for this file, see if the architecture is
compatible with the output file. If it isn't, keep searching.
If we can't open the file as an object file, stop the search
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 5c4581f..ce333b4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6643,7 +6643,6 @@ lang_process (void)
einfo (_("%P%F: %s: plugin reported error after all symbols read\n"),
plugin_error_plugin ());
/* Open any newly added files, updating the file chains. */
- link_info.loading_lto_outputs = TRUE;
open_input_bfds (*added.tail, OPEN_BFD_NORMAL);
/* Restore the global list pointer now they have all been added. */
lang_list_remove_tail (stat_ptr, &added);
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 69d21a7..7cb7610 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -283,6 +283,9 @@ struct lang_input_statement_flags
/* Set if the file was claimed from an archive. */
unsigned int claim_archive : 1;
+
+ /* Set if added by the lto plugin add_input_file callback. */
+ unsigned int lto_output : 1;
#endif /* ENABLE_PLUGINS */
/* Head of list of pushed flags. */
diff --git a/ld/plugin.c b/ld/plugin.c
index 4fee305..31527ae 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -772,10 +772,14 @@ get_symbols_v2 (const void *handle, int nsyms, struct ld_plugin_symbol *syms)
static enum ld_plugin_status
add_input_file (const char *pathname)
{
+ lang_input_statement_type *is;
+
ASSERT (called_plugin);
- if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_file_enum,
- NULL))
+ is = lang_add_input_file (xstrdup (pathname), lang_input_file_is_file_enum,
+ NULL);
+ if (!is)
return LDPS_ERR;
+ is->flags.lto_output = 1;
return LDPS_OK;
}
@@ -783,10 +787,14 @@ add_input_file (const char *pathname)
static enum ld_plugin_status
add_input_library (const char *pathname)
{
+ lang_input_statement_type *is;
+
ASSERT (called_plugin);
- if (!lang_add_input_file (xstrdup (pathname), lang_input_file_is_l_enum,
- NULL))
+ is = lang_add_input_file (xstrdup (pathname), lang_input_file_is_l_enum,
+ NULL);
+ if (!is)
return LDPS_ERR;
+ is->flags.lto_output = 1;
return LDPS_OK;
}