linux-mips
[Top] [All Lists]

Re: [PATCH v3] MIPS: kernel: elf: Improve the overall ABI and FPU mode c

To: Markos Chandras <markos.chandras@imgtec.com>
Subject: Re: [PATCH v3] MIPS: kernel: elf: Improve the overall ABI and FPU mode checks
From: Måns Rullgård <mans@mansr.com>
Date: Tue, 24 Feb 2015 14:06:05 +0000
Cc: <linux-mips@linux-mips.org>, Matthew Fortune <Matthew.Fortune@imgtec.com>, Paul Burton <paul.burton@imgtec.com>
In-reply-to: <20150224135225.GA23928@mchandras-linux.le.imgtec.org> (Markos Chandras's message of "Tue, 24 Feb 2015 13:52:25 +0000")
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <6D39441BF12EF246A7ABCE6654B0235320FBCA7C@LEMAIL01.le.imgtec.org> <1422893593-1291-1-git-send-email-markos.chandras@imgtec.com> <yw1xwq3778k2.fsf@unicorn.mansr.com> <20150224135225.GA23928@mchandras-linux.le.imgtec.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Markos Chandras <markos.chandras@imgtec.com> writes:

> Hi,
>
> On Tue, Feb 24, 2015 at 01:17:33PM +0000, Måns Rullgård wrote:
>> This patch (well, the variant that made it into 4.0-rc1) breaks
>> MIPS_ABI_FP_DOUBLE (the gcc default) apps on MIPS32.
>> 
>
> Thanks for the report.
>
>> > +void mips_set_personality_fp(struct arch_elf_state *state)
>> > +{
>> > +  /*
>> > +   * This function is only ever called for O32 ELFs so we should
>> > +   * not be worried about N32/N64 binaries.
>> > +   */
>> >
>> > -  case MIPS_ABI_FP_XX:
>> > -  case MIPS_ABI_FP_ANY:
>> > -          if (!config_enabled(CONFIG_MIPS_O32_FP64_SUPPORT))
>> > -                  set_thread_flag(TIF_32BIT_FPREGS);
>> > -          else
>> > -                  clear_thread_flag(TIF_32BIT_FPREGS);
>> > +  if (!config_enabled(CONFIG_MIPS_O32_FP64_SUPPORT))
>> > +          return;
>> 
>> The problem is here.  In a 32-bit configuration, MIPS_O32_FP64_SUPPORT
>> is always disabled, so the FP mode doesn't get set.  Simply deleting
>> those two lines makes things work again, but that's probably not the
>> right fix.
>> 
> I had the impression that the loader would have set the FP mode earlier on.
> But that only may happen with the latest version of the tools.
>
> Perhaps instead of dropping these two lines we need a similar check on the
> arch_elf_pt_proc so we don't mess with the default FPI abi?
>
> Having said that, dropping these two lines should be fine, it just means you
> do a little bit of extra work when loading your ELF files to check for ABI
> compatibility which shouldn't matter in your case.

There's another early return like this in arch_check_elf() which should
probably go as well, or everything will end up with the default mode.

-- 
Måns Rullgård
mans@mansr.com

<Prev in Thread] Current Thread [Next in Thread>