From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Mark H Weaver <mhw@netris.org>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI.
Date: Sun, 23 Aug 2015 12:51:13 +0300 [thread overview]
Message-ID: <55D99791.4080104@gmail.com> (raw)
In-Reply-To: <876147ryhy.fsf@netris.org>
22.08.2015 21:04, Mark H Weaver пишет:
> Andrei Borzenkov <arvidjaar@gmail.com> 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.
>>> ---
>>> 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:
>
> mhw@librenote:~$ clang -mabi=32 mips.S
> error: unknown target CPU 'mips32r2'
>
Are you on native MIPS platform or cross-compiling? Which clang version?
This works for me using current upstream clang (I do not have cross
binutils so linking fails, but that's different story).
bor@bor-Latitude-E5450:~/build/grub$ ~/build/llvm/bin/clang
--target=mips -mabi=32 -v -integrated-as -c asm-tests/mips.S
clang version 3.8.0 (git://github.com/llvm-mirror/clang.git
2b06a033d151865ca944dedf899e9b36aa630f42)
(git://github.com/llvm-mirror/llvm.git
8f7e8462cdf3b0eed913202b81f14e2fead62be4)
Target: mips
Thread model: posix
InstalledDir: /home/bor/build/llvm/bin
"/home/bor/build/llvm/bin/clang-3.8" -cc1 -triple mips -E
-disable-free -main-file-name mips.S -mrelocation-model static
-mthread-model posix -mdisable-fp-elim -fmath-errno
-mconstructor-aliases -target-cpu mips32r2 -target-abi o32 -mfloat-abi
hard -v -dwarf-column-info -coverage-file /home/bor/build/grub/mips.S
-resource-dir /home/bor/build/llvm/bin/../lib/clang/3.8.0
-fdebug-compilation-dir /home/bor/build/grub -ferror-limit 19
-fmessage-length 95 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -o /tmp/mips-b9949a.s -x assembler-with-cpp
asm-tests/mips.S
clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target
x86_64-unknown-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/home/bor/build/llvm/bin/../lib/clang/3.8.0/include
/usr/include
End of search list.
"/home/bor/build/llvm/bin/clang-3.8" -cc1as -triple mips -filetype obj
-main-file-name mips.S -target-cpu mips32r2 -fdebug-compilation-dir
/home/bor/build/grub -dwarf-debug-producer clang version 3.8.0
(git://github.com/llvm-mirror/clang.git
2b06a033d151865ca944dedf899e9b36aa630f42)
(git://github.com/llvm-mirror/llvm.git
8f7e8462cdf3b0eed913202b81f14e2fead62be4) -mrelocation-model static
-target-abi o32 -o mips.o /tmp/mips-b9949a.s
Actually this works for me also without -mabi=32 and produced object
type is identical
> However, it doesn't work without that option either:
>
> mhw@librenote:~$ clang mips.S
> mips.S: Assembler messages:
> mips.S:7: Error: invalid operands `ld $t2,0($t6)'
> mips.S:10: Error: invalid operands `addiu $t7,$s0,(b-a)'
> clang-3.6: error: assembler command failed with exit code 1 (use -v to see invocation)
>
> This is the same failure that occurs with gcc when configured to use the
> N32 ABI by default. I also tried passing -fno-integrated-as in both
> cases above, but it made no difference.
>
> Mark
>
next prev parent reply other threads:[~2015-08-23 9:51 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 18:35 [PATCH] Ensure that MIPS target code is compiled for the O32 ABI Mark H Weaver
2015-08-21 4:05 ` Andrei Borzenkov
2015-08-22 18:04 ` Mark H Weaver
2015-08-23 9:51 ` Andrei Borzenkov [this message]
2015-08-23 17:27 ` Mark H Weaver
2015-08-24 6:50 ` [PATCH v2] " Mark H Weaver
2015-09-08 17:11 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-09-09 1:37 ` Mark H Weaver
2015-09-13 6:32 ` Andrei Borzenkov
2015-10-09 21:14 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-10-10 0:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-10-14 4:49 ` Andrei Borzenkov
2015-10-14 12:16 ` Vladimir 'phcoder' Serbinenko
2015-10-14 17:57 ` Andrei Borzenkov
2015-08-24 7:19 ` [PATCH] " Andrei Borzenkov
2015-08-24 7:57 ` Mark H Weaver
2015-08-24 8:12 ` Andrei Borzenkov
2015-08-24 9:27 ` Andrei Borzenkov
2015-08-25 18:18 ` Mark H Weaver
2015-09-11 15:06 ` Andrei Borzenkov
2015-09-13 2:41 ` Mark H Weaver
2015-09-13 3:46 ` Mark H Weaver
2015-09-13 14:10 ` Andrei Borzenkov
2015-09-13 23:37 ` Mark H Weaver
2015-09-20 4:44 ` Andrei Borzenkov
2015-09-21 16:09 ` Mark H Weaver
2015-09-21 17:56 ` Andrei Borzenkov
2015-09-22 15:03 ` Mark H Weaver
2015-09-22 17:26 ` Andrei Borzenkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55D99791.4080104@gmail.com \
--to=arvidjaar@gmail.com \
--cc=grub-devel@gnu.org \
--cc=mhw@netris.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.