From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZTRvy-0006CY-F9 for mharc-grub-devel@gnu.org; Sun, 23 Aug 2015 05:51:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53850) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTRvt-00068l-Vu for grub-devel@gnu.org; Sun, 23 Aug 2015 05:51:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZTRvp-00010P-01 for grub-devel@gnu.org; Sun, 23 Aug 2015 05:51:21 -0400 Received: from mail-la0-x22e.google.com ([2a00:1450:4010:c03::22e]:34673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZTRvo-000101-JV for grub-devel@gnu.org; Sun, 23 Aug 2015 05:51:16 -0400 Received: by laba3 with SMTP id a3so62072746lab.1 for ; Sun, 23 Aug 2015 02:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Bz0Lbb3Bfh+0TeHOLok/IsMWca76WRmoJLea02R0gng=; b=JLLIoRJRyY2pT51sbPS4QE/PPGMMdPklPjeU/x30FVnQ3cKN1y9K2Vifqpp2w/LWrh gJlnzTaSpwsSUrlFq51kifApFur3HrYD0fW5DQ/fuSzauB9lixdQwxj+v4h+qZLXou6f Kyg3bB80oo9gkTK7trze7eTIWG8sgkgHaS7/54/Y/QpwFgfiLmRFYsEmAc/ziyFAGSZL 4YeSU7AyL/ogAREEzq+BZC6J6whV2F+3rfb1L2IIF31JCwmCyWIHUen4kYC8sncXoV05 FetaNEGhYOMrsfNCPh1DpmhgfaPEvrgYV3mRzBuYhQK6Lk2Ik3jLOcU/fI0ywGyD0h6h pQ/g== X-Received: by 10.152.22.99 with SMTP id c3mr15769654laf.32.1440323474857; Sun, 23 Aug 2015 02:51:14 -0700 (PDT) Received: from [192.168.1.43] (ppp91-76-5-127.pppoe.mtu-net.ru. [91.76.5.127]) by smtp.gmail.com with ESMTPSA id lb8sm4053645lab.16.2015.08.23.02.51.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Aug 2015 02:51:13 -0700 (PDT) Message-ID: <55D99791.4080104@gmail.com> Date: Sun, 23 Aug 2015 12:51:13 +0300 From: Andrei Borzenkov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Mark H Weaver Subject: Re: [PATCH] Ensure that MIPS target code is compiled for the O32 ABI. References: <1440009323-8667-1-git-send-email-mhw@netris.org> <55D6A36D.205@gmail.com> <876147ryhy.fsf@netris.org> In-Reply-To: <876147ryhy.fsf@netris.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22e Cc: The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2015 09:51:24 -0000 22.08.2015 21:04, Mark H Weaver пишет: > Andrei Borzenkov 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 >