This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
- From: Daniel Santos <daniel dot santos at pobox dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>, Andreas Schwab <schwab at suse dot de>
- Date: Wed, 23 Aug 2017 00:23:17 -0500
- Subject: Re: [PATCH] [i386] PR 81850 Don't ignore -mabi=sysv on Cygwin/MinGW
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4YXt2Oynx=bGumyFjaVDhL=QNboqVQdR1DCwA+YWPP9XQ@mail.gmail.com> <20170822194753.5405-1-daniel.santos@pobox.com> <CAFULd4ZwB0kL_Yn25TtM3=YLfO3LW19s6ynPTeiXqV0kCnTkLg@mail.gmail.com>
On 08/22/2017 03:00 PM, Uros Bizjak wrote:
> On Tue, Aug 22, 2017 at 9:47 PM, Daniel Santos <daniel.santos@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
>>