This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch] Mark the start symbol as LDPR_PREVAILING_DEF.
- From: Rafael Espindola <espindola at google dot com>
- To: Binutils <binutils at sourceware dot org>
- Cc: Cary Coutant <ccoutant at google dot com>
- Date: Mon, 14 Jun 2010 18:38:35 -0400
- Subject: [patch] Mark the start symbol as LDPR_PREVAILING_DEF.
Currently if the start symbol is in a file claimed by a plugin, we
will return LDPR_PREVAILING_DEF_IRONLY for it. This causes the plugin
to drop it and we get a binary that cannot be executed.
The attached patch sets the in_real_elf flag for the start symbol.
Thanks a lot to Cary for pointing me to the correct place to do this!
2010-06-14 Rafael Espindola <espindola@google.com>
* plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
Cheers,
--
Rafael Ãvila de EspÃndola
diff --git a/gold/plugin.cc b/gold/plugin.cc
index 798b601..4cf2f6a 100644
--- a/gold/plugin.cc
+++ b/gold/plugin.cc
@@ -916,6 +916,14 @@ void
Plugin_hook::run(Workqueue* workqueue)
{
gold_assert(this->options_.has_plugins());
+ Symbol* start_sym;
+ if (parameters->options().entry())
+ start_sym = this->symtab_->lookup(parameters->options().entry());
+ else
+ start_sym = this->symtab_->lookup("_start");
+ if (start_sym != NULL)
+ start_sym->set_in_real_elf();
+
this->options_.plugins()->all_symbols_read(workqueue,
this,
this->input_objects_,