grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI.


From: Mark H Weaver
Subject: Re: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI.
Date: Sun, 23 Aug 2015 13:27:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Andrei Borzenkov <address@hidden> writes:

> 22.08.2015 21:04, Mark H Weaver пишет:
>> Andrei Borzenkov <address@hidden> writes:
>>
>>> 19.08.2015 21:35, Mark H Weaver пишет:
>>>> Include -mabi=32 in CFLAGS_PLATFORM and CCASFLAGS_PLATFORM to compile
>>>> code for the O32 ABI when targetting MIPS, since the MIPS assembly code
>>>> in GRUB assumes this.  This flag is also needed when compiling
>>>> asm-tests/mips.S from configure, because GNU as rejects MIPS register
>>>> names such as $t2 unless the O32 ABI is selected.
>
> BTW, I assume this did work at some point; so this needs more verbose
> explanation what changed and why it stopped working.

It worked, and probably still works, on MIPS systems that use the O32
ABI.  It has never worked on systems that use one of the newer ABIs for
MIPS.

>>>> ---
>>>>    conf/Makefile.common | 4 ++++
>>>>    configure.ac         | 7 +++++--
>>>>    2 files changed, 9 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/conf/Makefile.common b/conf/Makefile.common
>>>> index fcb8d2e..bd125da 100644
>>>> --- a/conf/Makefile.common
>>>> +++ b/conf/Makefile.common
>>>> @@ -20,6 +20,10 @@ endif
>>>>    if COND_powerpc_ieee1275
>>>>      CFLAGS_PLATFORM += -mcpu=powerpc
>>>>    endif
>>>> +if COND_mips
>>>> +  CFLAGS_PLATFORM += -mabi=32
>>>> +  CCASFLAGS_PLATFORM = -mabi=32
>>>> +endif
>>>>
>>>
>>> Does it work with clang?
>>
>> Based on the error message below, clang seems to accept and understand
>> the -mabi=32 option, but the version of clang that we have in GNU Guix
>> (which uses the N32 ABI on MIPS) seems to lack support for compiling for
>> O32:
>>
>>    address@hidden:~$ clang -mabi=32 mips.S
>>    error: unknown target CPU 'mips32r2'
>>
>
> Are you on native MIPS platform or cross-compiling?

I've done all of my tests on a native MIPS platform.  I haven't tried
cross-compiling, and would prefer to avoid it.

> Which clang version?

3.6.0.

> This works for me using current upstream clang (I do not have
> cross binutils so linking fails, but that's different story).
[...]
> Actually this works for me also without -mabi=32 and produced object
> type is identical

That's because the compiler you're using has been configured to use the
O32 ABI by default.  In that case, -mabi=32 has no effect because that
flag means "compile for the O32 ABI", which is already the default.

    Thanks,
      Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]