* [m68k] Fix option handling for -m68020-40 and -m68020-60
@ 2012-10-23 18:10 Gunther Nikl
2012-10-23 20:14 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Gunther Nikl @ 2012-10-23 18:10 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: Andreas Schwab, gcc-patches
Hello,
While working with GCC 4.7, I noticed that the -m68020-40 and -m68020-60
options are broken. This bug was introduced in May 2011 with the patch
at <http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02278.html>. The code
in m68k_option_override to set cpu and tune doesn't trigger when using
-m68020-40 and -m68020-60 since global_options_set is not touched by
the evaluation code for -m68020-40 and -m68020-60 in m68k_handle_option.
This patch was tested by checking the -dM output of a patched cc1 for
the present __mc680X0__ macros.
Regards,
Gunther Nikl
-- cut --
2012-10-23 Gunther Nikl <gnikl@users.sourceforge.net>
* common/config/m68k/m68k-common.c (m68k_handle_option): Set
gcc_options fields of opts_set for -m68020-40 and -m68020-60.
-- cut --
Index: common/config/m68k/m68k-common.c
===================================================================
--- common/config/m68k/m68k-common.c (revision 192718)
+++ common/config/m68k/m68k-common.c (working copy)
@@ -33,7 +33,7 @@
static bool
m68k_handle_option (struct gcc_options *opts,
- struct gcc_options *opts_set ATTRIBUTE_UNUSED,
+ struct gcc_options *opts_set,
const struct cl_decoded_option *decoded,
location_t loc)
{
@@ -45,12 +45,16 @@
{
case OPT_m68020_40:
opts->x_m68k_tune_option = u68020_40;
+ opts_set->x_m68k_tune_option = (uarch_type) 1;
opts->x_m68k_cpu_option = m68020;
+ opts_set->x_m68k_cpu_option = (target_device) 1;
return true;
case OPT_m68020_60:
opts->x_m68k_tune_option = u68020_60;
+ opts_set->x_m68k_tune_option = (uarch_type) 1;
opts->x_m68k_cpu_option = m68020;
+ opts_set->x_m68k_cpu_option = (target_device) 1;
return true;
case OPT_mshared_library_id_:
-- cut --
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [m68k] Fix option handling for -m68020-40 and -m68020-60
2012-10-23 18:10 [m68k] Fix option handling for -m68020-40 and -m68020-60 Gunther Nikl
@ 2012-10-23 20:14 ` Andreas Schwab
2012-10-25 15:56 ` Gunther Nikl
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2012-10-23 20:14 UTC (permalink / raw)
To: Gunther Nikl; +Cc: Joseph S. Myers, gcc-patches
Gunther Nikl <gnikl@users.sourceforge.net> writes:
> While working with GCC 4.7, I noticed that the -m68020-40 and -m68020-60
> options are broken.
Broken in which way?
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [m68k] Fix option handling for -m68020-40 and -m68020-60
2012-10-23 20:14 ` Andreas Schwab
@ 2012-10-25 15:56 ` Gunther Nikl
2012-10-26 19:41 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Gunther Nikl @ 2012-10-25 15:56 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Joseph S. Myers, gcc-patches
Andreas Schwab wrote:
> Gunther Nikl <gnikl@users.sourceforge.net> writes:
>
>> While working with GCC 4.7, I noticed that the -m68020-40 and -m68020-60
>> options are broken.
>
> Broken in which way?
These compound options are supposed to cause m68k.c/m68k_option_override
to set m68k_cpu_entry and m68k_tune_entry. However that code does only
trigger if cpu/tune fields in global_options_set are nonzero which only
happens if -mcpu=/-mtune= are used. My patch for m68k_handle_option
simply sets cpu and tune fields in the provided opts_set function
argument.
The bug is more visible with a compiler configured for a plain 68000
because such a compiler will generate normal 68000 code despite
requesting 68020 code with -m68020-40 or -m68020-60. The bug can also
be seen with a compiler defaulting to 68020 code because the expected
mc680x0 macros are not present. eg.
m68k-elf-gcc -m68020-40 -x c /dev/null -E -dM -o - | grep mc68
will only show __mc68020__, but __mc680[34]0__ should be defined
as well, see m68k.h/TARGET_CPU_CPP_BUILTINS.
The patch should be installed on trunk and on the 4.7 branch.
Regards,
Gunther
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [m68k] Fix option handling for -m68020-40 and -m68020-60
2012-10-25 15:56 ` Gunther Nikl
@ 2012-10-26 19:41 ` Andreas Schwab
2012-10-28 11:27 ` Gunther Nikl
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2012-10-26 19:41 UTC (permalink / raw)
To: Gunther Nikl; +Cc: Joseph S. Myers, gcc-patches
Gunther Nikl <gnikl@users.sourceforge.net> writes:
> The patch should be installed on trunk and on the 4.7 branch.
Thanks, done. The 4.7 branch required some adjustment, since it's not
compiled as C++.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [m68k] Fix option handling for -m68020-40 and -m68020-60
2012-10-26 19:41 ` Andreas Schwab
@ 2012-10-28 11:27 ` Gunther Nikl
0 siblings, 0 replies; 5+ messages in thread
From: Gunther Nikl @ 2012-10-28 11:27 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Joseph S. Myers, gcc-patches
Andreas Schwab wrote:
> Gunther Nikl <gnikl@users.sourceforge.net> writes:
>
>> The patch should be installed on trunk and on the 4.7 branch.
>
> Thanks, done. The 4.7 branch required some adjustment, since it's not
> compiled as C++.
Right. Maybe a better solution would have been then to only change
m68k.c/m68k_option_override to additionally check for -m68020-[46]0
in global_options_set when setting cpu and tune entries.
Thank you for taking care of the patch. Sorry that I didn't remember
to adjust the copyright year.
Regards,
Gunther Nikl
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-28 10:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-23 18:10 [m68k] Fix option handling for -m68020-40 and -m68020-60 Gunther Nikl
2012-10-23 20:14 ` Andreas Schwab
2012-10-25 15:56 ` Gunther Nikl
2012-10-26 19:41 ` Andreas Schwab
2012-10-28 11:27 ` Gunther Nikl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).