Message ID | 5086DD70.3010603@users.sourceforge.net |
---|---|
State | New |
Headers | show |
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 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
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 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
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_: