This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Add --allow-multiple-definition aka -z muldefs
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Mon, 04 Jan 2010 21:57:14 -0800
- Subject: gold patch committed: Add --allow-multiple-definition aka -z muldefs
I committed this path to gold to implement the option
--allow-multiple-definition and its synonym -z muldefs.
Ian
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.
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.127
diff -p -u -r1.127 options.h
--- options.h 5 Jan 2010 00:32:22 -0000 1.127
+++ options.h 5 Jan 2010 05:54:45 -0000
@@ -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"));
Index: resolve.cc
===================================================================
RCS file: /cvs/src/src/gold/resolve.cc,v
retrieving revision 1.48
diff -p -u -r1.48 resolve.cc
--- resolve.cc 29 Dec 2009 00:31:48 -0000 1.48
+++ resolve.cc 5 Jan 2010 05:54:45 -0000
@@ -440,9 +440,11 @@ Symbol_table::should_override(const Symb
|| (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: