From 6dce9e24b33d97ac8adc28a5f830556626226204 Mon Sep 17 00:00:00 2001 From: Thiemo Seufer Date: Tue, 7 Aug 2001 12:46:22 +0000 Subject: [PATCH] * config/tc-mips.c (md_begin): Take -mcpu value into account even when -mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs mutually exclusive (if they are different). (md_parse_option): Warn if an -march/-mtune/-mcpu/-m option is set more than once. --- gas/ChangeLog | 8 ++++++ gas/config/tc-mips.c | 65 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 13 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 0dca9480986..6a71280633b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,11 @@ +2001-07-30 Thiemo Seufer + + * config/tc-mips.c (md_begin): Take -mcpu value into account even when + -mipsX is specified. Make both -mcpu/-march and -mcpu/-mtune pairs + mutually exclusive (if they are different). + (md_parse_option): Warn if an -march/-mtune/-mcpu/-m option is + set more than once. + 2001-08-03 Richard Sandiford * config/tc-mips.c (md_apply_fix): Don't subtract the symbol value diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 74e206a3ee2..6bb31ae0776 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -962,6 +962,33 @@ md_begin () if (mips_opts.mips16 < 0) mips_opts.mips16 = target_cpu_had_mips16; + /* Backward compatibility for historic -mcpu= option. Check for + incompatible options, warn if -mcpu is used. */ + if (mips_cpu != CPU_UNKNOWN + && mips_arch != CPU_UNKNOWN + && mips_cpu != mips_arch) + { + as_fatal (_("The -mcpu option can't be used together with -march. " + "Use -mtune instead of -mcpu.")); + } + + if (mips_cpu != CPU_UNKNOWN + && mips_tune != CPU_UNKNOWN + && mips_cpu != mips_tune) + { + as_fatal (_("The -mcpu option can't be used together with -mtune. " + "Use -march instead of -mcpu.")); + } + + if (mips_arch == CPU_UNKNOWN && mips_cpu != CPU_UNKNOWN) + { + ci = mips_cpu_info_from_cpu (mips_cpu); + assert (ci != NULL); + mips_arch = ci->cpu; + as_warn (_("The -mcpu option is deprecated. Please use -march and " + "-mtune instead.")); + } + /* At this point, mips_arch will either be CPU_UNKNOWN if no ARCH was specified on the command line, or some other value if one was. Similarly, mips_opts.isa will be ISA_UNKNOWN if not specified on @@ -984,19 +1011,6 @@ md_begin () assert (ci != NULL); mips_arch = ci->cpu; } - else if (mips_arch == CPU_UNKNOWN - && mips_opts.isa == ISA_UNKNOWN - && mips_cpu != CPU_UNKNOWN) - { - /* Historic -mcpu= option. Warn. */ - ci = mips_cpu_info_from_cpu (mips_cpu); - assert (ci != NULL); - mips_arch = ci->cpu; - mips_tune = ci->cpu; - mips_opts.isa = ci->isa; - as_warn (_("The -mcpu option is deprecated. Please use -march and -mtune instead.")); - - } else { /* We need to set both ISA and ARCH from target cpu. */ @@ -8985,18 +8999,31 @@ md_parse_option (c, arg) switch (c) { case OPTION_MTUNE: + if (mips_tune != CPU_UNKNOWN && mips_tune != cpu) + as_warn(_("A different -mtune= was already specified, is now " + "-mtune=%s"), arg); mips_tune = cpu; break; case OPTION_MARCH: + if (mips_arch != CPU_UNKNOWN && mips_arch != cpu) + as_warn(_("A different -march= was already specified, is now " + "-march=%s"), arg); mips_arch = cpu; break; case OPTION_MCPU: + if (mips_cpu != CPU_UNKNOWN && mips_cpu != cpu) + as_warn(_("A different -mcpu= was already specified, is now " + "-mcpu=%s"), arg); mips_cpu = cpu; } } break; case OPTION_M4650: + if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_R4650) + || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_R4650)) + as_warn(_("A different -march= or -mtune= was already specified, " + "is now -m4650")); mips_arch = CPU_R4650; mips_tune = CPU_R4650; break; @@ -9005,6 +9032,10 @@ md_parse_option (c, arg) break; case OPTION_M4010: + if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_R4010) + || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_R4010)) + as_warn(_("A different -march= or -mtune= was already specified, " + "is now -m4010")); mips_arch = CPU_R4010; mips_tune = CPU_R4010; break; @@ -9013,6 +9044,10 @@ md_parse_option (c, arg) break; case OPTION_M4100: + if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_VR4100) + || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_VR4100)) + as_warn(_("A different -march= or -mtune= was already specified, " + "is now -m4100")); mips_arch = CPU_VR4100; mips_tune = CPU_VR4100; break; @@ -9021,6 +9056,10 @@ md_parse_option (c, arg) break; case OPTION_M3900: + if ((mips_arch != CPU_UNKNOWN && mips_arch != CPU_R3900) + || (mips_tune != CPU_UNKNOWN && mips_tune != CPU_R3900)) + as_warn(_("A different -march= or -mtune= was already specified, " + "is now -m3900")); mips_arch = CPU_R3900; mips_tune = CPU_R3900; break; -- 2.30.2