* PR30343 infrastructure
@ 2023-04-19 23:10 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-04-19 23:10 UTC (permalink / raw)
To: binutils
Make ldemul_before_plugin_all_symbols_read more useful. This isn't a
fix for the PR, but will be required I think.
* ldlang.c (lang_process): Move call to
ldemul_before_plugin_all_symbols_read outside BFD_SUPPORTS_PLUGINS.
Allow backends to add to gc_sym_list before handling entry sym.
* ldelf.c (ldelf_before_plugin_all_symbols_read): Test
lto_plugin_active.
diff --git a/ld/ldelf.c b/ld/ldelf.c
index eff6693e052..f9a6819366f 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1215,7 +1215,8 @@ ldelf_before_plugin_all_symbols_read (int use_libpath, int native,
{
struct elf_link_hash_table *htab = elf_hash_table (&link_info);
- if (!is_elf_hash_table (&htab->root))
+ if (!link_info.lto_plugin_active
+ || !is_elf_hash_table (&htab->root))
return;
htab->handling_dt_needed = true;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index b684e2d479a..006031b5a65 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -7964,14 +7964,14 @@ lang_process (void)
statements we can give values to symbolic origin/length now. */
lang_do_memory_regions (true);
+ ldemul_before_plugin_all_symbols_read ();
+
#if BFD_SUPPORTS_PLUGINS
if (link_info.lto_plugin_active)
{
lang_statement_list_type added;
lang_statement_list_type files, inputfiles;
- ldemul_before_plugin_all_symbols_read ();
-
/* Now all files are read, let the plugin(s) decide if there
are any more to be added to the link before we call the
emulation's after_open hook. We create a private list of
@@ -8074,17 +8074,17 @@ lang_process (void)
}
#endif /* BFD_SUPPORTS_PLUGINS */
- /* Make sure that nobody has tried to add a symbol to this list
- before now. */
- ASSERT (link_info.gc_sym_list == NULL);
+ struct bfd_sym_chain **sym = &link_info.gc_sym_list;
+ while (*sym)
+ sym = &(*sym)->next;
- link_info.gc_sym_list = &entry_symbol;
+ *sym = &entry_symbol;
if (entry_symbol.name == NULL)
{
- link_info.gc_sym_list = ldlang_undef_chain_list_head;
+ *sym = ldlang_undef_chain_list_head;
- /* entry_symbol is normally initialied by a ENTRY definition in the
+ /* entry_symbol is normally initialised by an ENTRY definition in the
linker script or the -e command line option. But if neither of
these have been used, the target specific backend may still have
provided an entry symbol via a call to lang_default_entry().
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-19 23:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 23:10 PR30343 infrastructure Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).