summaryrefslogtreecommitdiff
path: root/gold/parameters.cc
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-10-16 08:04:58 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-10-16 08:05:09 -0700
commit6457197210144f50a696097c0d308d81d46d5510 (patch)
treedc8ba9a38f4bc0a79bf27dba208599434dbeff0c /gold/parameters.cc
parente66acfb155e75c1909a6f29702ed6ba3762e36b4 (diff)
downloadbinutils-gdb-6457197210144f50a696097c0d308d81d46d5510.tar.gz
Don't ignore "-m emulation" command line option
Gold shouldn't ignore "-m emulation" command line option, which may lead to incorrect output. PR gold/19119 * options.h (General_options): Remove "obsolete" from -m. * parameters.cc (set_parameters_target): Check if input target is compatible with output emulation set by "-m emulation".
Diffstat (limited to 'gold/parameters.cc')
-rw-r--r--gold/parameters.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gold/parameters.cc b/gold/parameters.cc
index 5ed19122512..15df42afc9b 100644
--- a/gold/parameters.cc
+++ b/gold/parameters.cc
@@ -297,6 +297,16 @@ set_parameters_options(const General_options* options)
void
set_parameters_target(Target* target)
{
+ if (parameters->options_valid() && parameters->options().user_set_m())
+ {
+ const char* emulation = parameters->options().m();
+ Target* output = select_target_by_emulation(emulation);
+ if (!output)
+ gold_error(_("unrecognised output emulation: %s"), emulation);
+ else if (output != target)
+ gold_error(_("input file is incompatible with %s output emulation"),
+ emulation);
+ }
static_parameters.set_target(target);
}