From: Ian Lance Taylor Date: Tue, 5 Jan 2010 00:32:22 +0000 (+0000) Subject: PR 10980 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7eaea5495ab1b0dfbedaba749e249cfc92b9d7c6;p=binutils-gdb.git PR 10980 * options.h (class General_options): Add --add-needed and --copy-dt-needed-entries. Tweak --as-needed help entry. * object.cc (Input_objects::check_dynamic_dependencies): Give an error if --copy-dt-needed-entries aka --add-needed is used and would cause a change in behaviour. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 768c794482f..6d36ca76806 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,5 +1,12 @@ 2010-01-04 Ian Lance Taylor + PR 10980 + * options.h (class General_options): Add --add-needed and + --copy-dt-needed-entries. Tweak --as-needed help entry. + * object.cc (Input_objects::check_dynamic_dependencies): Give an + error if --copy-dt-needed-entries aka --add-needed is used and + would cause a change in behaviour. + PR 10980 * options.h (class General_options): Add -G as a short version of --shared. Add no-op options -assert, -g, and -i. diff --git a/gold/object.cc b/gold/object.cc index 34b59b5dd09..127e3a6d651 100644 --- a/gold/object.cc +++ b/gold/object.cc @@ -2162,15 +2162,15 @@ Input_objects::add_object(Object* obj) void Input_objects::check_dynamic_dependencies() const { + bool issued_copy_dt_needed_error = false; for (Dynobj_list::const_iterator p = this->dynobj_list_.begin(); p != this->dynobj_list_.end(); ++p) { const Dynobj::Needed& needed((*p)->needed()); bool found_all = true; - for (Dynobj::Needed::const_iterator pneeded = needed.begin(); - pneeded != needed.end(); - ++pneeded) + Dynobj::Needed::const_iterator pneeded; + for (pneeded = needed.begin(); pneeded != needed.end(); ++pneeded) { if (this->sonames_.find(*pneeded) == this->sonames_.end()) { @@ -2179,6 +2179,25 @@ Input_objects::check_dynamic_dependencies() const } } (*p)->set_has_unknown_needed_entries(!found_all); + + // --copy-dt-needed-entries aka --add-needed is a GNU ld option + // --that gold does not support. However, they cause no trouble + // --unless there is a DT_NEEDED entry that we don't know about; + // --warn only in that case. + if (!found_all + && !issued_copy_dt_needed_error + && (parameters->options().copy_dt_needed_entries() + || parameters->options().add_needed())) + { + const char* optname; + if (parameters->options().copy_dt_needed_entries()) + optname = "--copy-dt-needed-entries"; + else + optname = "--add-needed"; + gold_error(_("%s is not supported but is required for %s in %s"), + optname, (*pneeded).c_str(), (*p)->name().c_str()); + issued_copy_dt_needed_error = true; + } } } diff --git a/gold/options.h b/gold/options.h index 8f26208b187..f6549ab104d 100644 --- a/gold/options.h +++ b/gold/options.h @@ -580,13 +580,17 @@ class General_options // alphabetical order). For both, lowercase sorts before uppercase. // The -z options come last. + DEFINE_bool(add_needed, options::TWO_DASHES, '\0', false, + N_("Not supported"), + N_("Do not copy DT_NEEDED tags from shared libraries")); + DEFINE_bool(allow_shlib_undefined, options::TWO_DASHES, '\0', false, N_("Allow unresolved references in shared libraries"), N_("Do not allow unresolved references in shared libraries")); DEFINE_bool(as_needed, options::TWO_DASHES, '\0', false, - N_("Only set DT_NEEDED for dynamic libs if used"), - N_("Always DT_NEEDED for dynamic libs")); + N_("Only set DT_NEEDED for shared libraries if used"), + N_("Always DT_NEEDED for shared libraries")); DEFINE_enum(assert, options::ONE_DASH, '\0', NULL, N_("Ignored"), N_("[ignored]"), @@ -631,6 +635,10 @@ class General_options {"none"}); #endif + DEFINE_bool(copy_dt_needed_entries, options::TWO_DASHES, '\0', false, + N_("Not supported"), + N_("Do not copy DT_NEEDED tags from shared libraries")); + DEFINE_bool(define_common, options::TWO_DASHES, 'd', false, N_("Define common symbols"), N_("Do not define common symbols"));