On 08/22/2017 03:00 PM, Uros Bizjak wrote: > On Tue, Aug 22, 2017 at 9:47 PM, Daniel Santos <daniel.san...@pobox.com> > wrote: >>> Please add UNKNOWN_ABI to the enum and initialize -mabi in i386.opt to >>> UNKNOWN_ABI. >> It would seem to me that UNSPECIFIED_ABI would be a better value name. >> >> Also, I don't really understand what opts_set and opts are, except that I had >> guessed opts_set is what the user asked for (or didn't ask for) and opts is >> what we're going to actually use. Am I close? > Yes. opts_set is a flag that user specified an option at the command line. > > However, I fail to see what is the problem. If nothing was specified, > then opts->x_ix86_abi is set to DEFAULT_ABI.
That is not what is happening. If -mabi=sysv is specified, then the test (!opts_set->x_ix86_abi) is true since the value of SYSV_ABI is zero. When that is evaluated as true, then the abi is set to DEFAULT_ABI, which on Windows is MS_ABI, thus ignoring the command line option. > Probably we don't need > Init(SYSV_ABI) in mabi= declaration at all. I'm guessing that if we don't specify an Init() option then it will default to zero? We just need a valid way to differentiate when -mabi=sysv has been passed from when nothing has been passed. Daniel > > Uros. > >> I'm re-running tests, so if they pass is this OK? >> >> Thanks, >> Daniel >> --- >> gcc/config/i386/i386-opts.h | 5 +++-- >> gcc/config/i386/i386.c | 3 +-- >> gcc/config/i386/i386.opt | 2 +- >> 3 files changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h >> index 542cd0f3d67..a1d1552a3c6 100644 >> --- a/gcc/config/i386/i386-opts.h >> +++ b/gcc/config/i386/i386-opts.h >> @@ -44,8 +44,9 @@ last_alg >> /* Available call abi. */ >> enum calling_abi >> { >> - SYSV_ABI = 0, >> - MS_ABI = 1 >> + UNSPECIFIED_ABI = 0, >> + SYSV_ABI = 1, >> + MS_ABI = 2 >> }; >> >> enum fpmath_unit >> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c >> index 650bcbc65ae..c08ad55fcd9 100644 >> --- a/gcc/config/i386/i386.c >> +++ b/gcc/config/i386/i386.c >> @@ -5681,12 +5681,11 @@ ix86_option_override_internal (bool main_args_p, >> opts->x_ix86_pmode = TARGET_LP64_P (opts->x_ix86_isa_flags) >> ? PMODE_DI : PMODE_SI; >> >> - if (!opts_set->x_ix86_abi) >> + if (opts_set->x_ix86_abi == UNSPECIFIED_ABI) >> opts->x_ix86_abi = DEFAULT_ABI; >> >> if (opts->x_ix86_abi == MS_ABI && TARGET_X32_P (opts->x_ix86_isa_flags)) >> error ("-mabi=ms not supported with X32 ABI"); >> - gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI); >> >> /* For targets using ms ABI enable ms-extensions, if not >> explicit turned off. For non-ms ABI we turn off this >> diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt >> index cd564315f04..f7b9f9707f7 100644 >> --- a/gcc/config/i386/i386.opt >> +++ b/gcc/config/i386/i386.opt >> @@ -525,7 +525,7 @@ Target Report Mask(IAMCU) >> Generate code that conforms to Intel MCU psABI. >> >> mabi= >> -Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) Init(SYSV_ABI) >> +Target RejectNegative Joined Var(ix86_abi) Enum(calling_abi) >> Init(UNSPECIFIED_ABI) >> Generate code that conforms to the given ABI. >> >> Enum >> -- >> 2.13.3 >>