This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH v2] Add support for O32 FPXX ABI
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- Cc: "macro\ at codesourcery dot com" <macro at codesourcery dot com>, "Joseph Myers \(joseph\ at codesourcery dot com\)" <joseph at codesourcery dot com>, "binutils\ at sourceware dot org" <binutils at sourceware dot org>, Rich Fuhler <Rich dot Fuhler at imgtec dot com>
- Date: Mon, 12 May 2014 16:23:07 +0100
- Subject: Re: [PATCH v2] Add support for O32 FPXX ABI
- Authentication-results: sourceware.org; auth=none
- References: <6D39441BF12EF246A7ABCE6654B023535269EB at LEMAIL01 dot le dot imgtec dot org> <87wqdsdlpg dot fsf at talisman dot default> <6D39441BF12EF246A7ABCE6654B0235352A9AE at LEMAIL01 dot le dot imgtec dot org>
Matthew Fortune <Matthew.Fortune@imgtec.com> writes:
>> > +/* Perform consistency checks on the module level options exactly
>> once.
>> > + This is a deferred check that happens:
>> > + at the first .set directive
>> > + or, at the first pseudo op that generates code
>> > + or, at the first instruction
>> > + or, at the end. */
>> > +
>> > +static void
>> > +file_mips_check_options (void)
>> > +{
>> > + int fpabi = Val_GNU_MIPS_ABI_FP_ANY;
>> > +
>> > + if (file_mips_opts_checked)
>> > + return;
>> > +
>> > + mips_check_options (&file_mips_opts, TRUE);
>> > + file_mips_opts_checked = TRUE;
>> > +
>> > + if (!bfd_set_arch_mach (stdoutput, bfd_arch_mips,
>> file_mips_opts.arch))
>> > + as_warn (_("could not set architecture and machine"));
>> > +
>> > + /* Soft-float gets precedence over single-float, the two options
>> should
>> > + not be used together so this should not matter. */
>> > + if (file_mips_opts.soft_float == 1)
>> > + fpabi = Val_GNU_MIPS_ABI_FP_SOFT;
>> > + /* Single-float gets precedence over all double_float cases. */
>> > + else if (file_mips_opts.single_float == 1)
>> > + fpabi = Val_GNU_MIPS_ABI_FP_SINGLE;
>> > + else
>> > + {
>> > + switch (file_mips_opts.fp)
>> > + {
>> > + case 32:
>> > + fpabi = Val_GNU_MIPS_ABI_FP_DOUBLE;
>> > + break;
>> > + case 0:
>> > + fpabi = Val_GNU_MIPS_ABI_FP_XX;
>> > + break;
>> > + case 64:
>> > + if (file_mips_opts.gp32)
>> > + fpabi = Val_GNU_MIPS_ABI_FP_64;
>> > + else
>> > + fpabi = Val_GNU_MIPS_ABI_FP_DOUBLE;
>> > + break;
>> > + }
>> > + }
>> > +
>> > + bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
>> > + Tag_GNU_MIPS_ABI_FP, fpabi);
>>
>> Won't this overwrite an explicit .gnu_attribute? Seems better to
>> set it at the end if no explicit .gnu_attribute was given.
>
> Darn it. Yes, but I need to do it earlier still as I can't do it
> at the end due to there being no way to distinguish between a file
> without a .gnu_attribute and one with .gnu_attribute 4,0 after
> assembly. I will have to add a hook for .gnu_attribute to run
> file_mips_check_options and hand off to the generic code. i.e.
>
> diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
> index 5bb4f61..8def394 100644
> --- a/gas/config/tc-mips.c
> +++ b/gas/config/tc-mips.c
> @@ -1702,6 +1702,7 @@ static const pseudo_typeS mips_pseudo_table[] =
> {"insn", s_insn, 0},
> {"nan", s_nan, 0},
> {"module", s_module, 0},
> + {"gnu_attribute", s_mips_gnu_attribute, 0},
>
> /* Relatively generic pseudo-ops that happen to be used on MIPS
> chips. */
> @@ -15394,6 +15395,16 @@ s_module (int ignore ATTRIBUTE_UNUSED)
> demand_empty_rest_of_line ();
> }
>
> +/* Handle the .gnu_attribute pseudo-op. */
> +
> +static void
> +s_mips_gnu_attribute (int ignore ATTRIBUTE_UNUSED)
> +{
> + file_mips_check_options ();
> +
> + obj_elf_vendor_attribute (OBJ_ATTR_GNU);
> +}
> +
> /* Handle the .abicalls pseudo-op. I believe this is equivalent to
> .option pic2. It means to generate SVR4 PIC calls. */
> === end ===
You are allowed to change things outside the MIPS code though :-)
It sounds like you all you want is a flag to say whether a given
attribute has been set explicitly by the assembly code or not.
I think it would be cleaner to make the generic code do that
rather than define an override in the MIPS code.
Thanks,
Richard