+2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
+
+ * options.h (class General_options): Add -init and -fini.
+ * layout.cc (Layout::finish_dynamic_section): Emit
+ given init and fini functions.
+
2009-10-13 Sriraman Tallam <tmsriram@google.com>
* gc.h (gc_process_relocs): Check if icf is enabled using new
odyn->add_string(elfcpp::DT_SONAME, soname);
}
- // FIXME: Support --init and --fini.
- Symbol* sym = symtab->lookup("_init");
+ Symbol* sym = symtab->lookup(parameters->options().init());
if (sym != NULL && sym->is_defined() && !sym->is_from_dynobj())
odyn->add_symbol(elfcpp::DT_INIT, sym);
- sym = symtab->lookup("_fini");
+ sym = symtab->lookup(parameters->options().fini());
if (sym != NULL && sym->is_defined() && !sym->is_from_dynobj())
odyn->add_symbol(elfcpp::DT_FINI, sym);
N_("Treat warnings as errors"),
N_("Do not treat warnings as errors"));
+ DEFINE_string(fini, options::ONE_DASH, '\0', "_fini",
+ N_("Call SYMBOL at unload-time"), N_("SYMBOL"));
+
DEFINE_string(soname, options::ONE_DASH, 'h', NULL,
N_("Set shared library name"), N_("FILENAME"));
DEFINE_special(incremental_unknown, options::TWO_DASHES, '\0',
N_("Use timestamps to check files (default)"), NULL);
+ DEFINE_string(init, options::ONE_DASH, '\0', "_init",
+ N_("Call SYMBOL at load-time"), N_("SYMBOL"));
+
DEFINE_special(just_symbols, options::TWO_DASHES, '\0',
N_("Read only symbol values from FILE"), N_("FILE"));