aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2010-01-05 05:56:28 +0000
committerIan Lance Taylor <ian@airs.com>2010-01-05 05:56:28 +0000
commit30bc8c4670a8c99dbfd7e7b31d2e794dab54fcda (patch)
tree97ff236eb15d44c0575de2f657401b69a569fcaa
parenta0f1928042c71027c8f908d10da8d1f7dd17530b (diff)
downloadgdb-30bc8c4670a8c99dbfd7e7b31d2e794dab54fcda.zip
gdb-30bc8c4670a8c99dbfd7e7b31d2e794dab54fcda.tar.gz
gdb-30bc8c4670a8c99dbfd7e7b31d2e794dab54fcda.tar.bz2
PR 10980
* options.h (class General_options): Add --allow-multiple-definition and -z muldefs. * resolve.cc (Symbol_table::should_override): Don't warn about a multiple symbol definition if --allow-multiple-definition or -z muldefs.
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/options.h9
-rw-r--r--gold/resolve.cc8
3 files changed, 21 insertions, 3 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 6d36ca7..934cba3 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,6 +1,13 @@
2010-01-04 Ian Lance Taylor <iant@google.com>
PR 10980
+ * options.h (class General_options): Add
+ --allow-multiple-definition and -z muldefs.
+ * resolve.cc (Symbol_table::should_override): Don't warn about a
+ multiple symbol definition if --allow-multiple-definition or -z
+ muldefs.
+
+ 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
diff --git a/gold/options.h b/gold/options.h
index f6549ab..08c5fdc 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -584,6 +584,10 @@ class General_options
N_("Not supported"),
N_("Do not copy DT_NEEDED tags from shared libraries"));
+ DEFINE_bool(allow_multiple_definition, options::TWO_DASHES, '\0', false,
+ N_("Allow multiple definitions of symbols"),
+ N_("Do not allow multiple definitions"));
+
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"));
@@ -998,6 +1002,11 @@ class General_options
NULL);
DEFINE_uint64(max_page_size, options::DASH_Z, '\0', 0,
N_("Set maximum page size to SIZE"), N_("SIZE"));
+ DEFINE_bool(muldefs, options::DASH_Z, '\0', false,
+ N_("Allow multiple definitions of symbols"),
+ NULL);
+ // copyreloc is here in the list because there is only -z
+ // nocopyreloc, not -z copyreloc.
DEFINE_bool(copyreloc, options::DASH_Z, '\0', true,
NULL,
N_("Do not create copy relocs"));
diff --git a/gold/resolve.cc b/gold/resolve.cc
index d32b2b9..24b80a8 100644
--- a/gold/resolve.cc
+++ b/gold/resolve.cc
@@ -440,9 +440,11 @@ Symbol_table::should_override(const Symbol* to, unsigned int frombits,
|| (object != NULL && object->just_symbols()))
return false;
- Symbol_table::report_resolve_problem(true,
- _("multiple definition of '%s'"),
- to, defined, object);
+ if (!parameters->options().allow_multiple_definition()
+ && !parameters->options().muldefs())
+ Symbol_table::report_resolve_problem(true,
+ _("multiple definition of '%s'"),
+ to, defined, object);
return false;
case WEAK_DEF * 16 + DEF: