diff -rcp ../binutils-2.20.51.0.2-original/gold/object.cc gold/object.cc *** ../binutils-2.20.51.0.2-original/gold/object.cc 2010-05-04 17:27:33.000000000 +0100 --- gold/object.cc 2010-05-04 17:31:43.000000000 +0100 *************** Input_objects::add_object(Object* obj) *** 2134,2148 **** void Input_objects::check_dynamic_dependencies() const { 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) { if (this->sonames_.find(*pneeded) == this->sonames_.end()) { --- 2134,2148 ---- 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; ! Dynobj::Needed::const_iterator pneeded; ! for (pneeded = needed.begin(); pneeded != needed.end(); ++pneeded) { if (this->sonames_.find(*pneeded) == this->sonames_.end()) { *************** Input_objects::check_dynamic_dependencie *** 2151,2156 **** --- 2151,2175 ---- } } (*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 -rcp ../binutils-2.20.51.0.2-original/gold/options.h gold/options.h *** ../binutils-2.20.51.0.2-original/gold/options.h 2010-05-04 17:28:20.000000000 +0100 --- gold/options.h 2010-05-04 17:29:43.000000000 +0100 *************** class General_options *** 571,583 **** // alphabetical order). For both, lowercase sorts before uppercase. // The -z options come last. 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")); // This should really be an "enum", but it's too easy for folks to // forget to update the list as they add new targets. So we just --- 571,587 ---- // 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 shared libraries if used"), ! N_("Always DT_NEEDED for shared libraries")); // This should really be an "enum", but it's too easy for folks to // forget to update the list as they add new targets. So we just *************** class General_options *** 618,623 **** --- 622,631 ---- {"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"));