From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ZaxFh-0005RY-D4 for mharc-grub-devel@gnu.org; Sat, 12 Sep 2015 22:42:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaxFf-0005RM-HK for grub-devel@gnu.org; Sat, 12 Sep 2015 22:42:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaxFa-0000HH-Gg for grub-devel@gnu.org; Sat, 12 Sep 2015 22:42:47 -0400 Received: from world.peace.net ([50.252.239.5]:56035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaxFa-0000HB-D1 for grub-devel@gnu.org; Sat, 12 Sep 2015 22:42:42 -0400 Received: from c-98-217-13-77.hsd1.ma.comcast.net ([98.217.13.77] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1ZaxFT-0005rs-5i; Sat, 12 Sep 2015 22:42:35 -0400 From: Mark H Weaver To: Andrei Borzenkov 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> <55DAC58C.1030105@gmail.com> <87si79nmp3.fsf@netris.org> <55DAD1F9.7080302@gmail.com> <55DAE394.6030306@gmail.com> <87mvxfp6y8.fsf@netris.org> <55F2EDF4.4040207@gmail.com> Date: Sat, 12 Sep 2015 22:41:30 -0400 In-Reply-To: <55F2EDF4.4040207@gmail.com> (Andrei Borzenkov's message of "Fri, 11 Sep 2015 18:06:28 +0300") Message-ID: <87a8srjb1h.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 50.252.239.5 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, 13 Sep 2015 02:42:48 -0000 Andrei Borzenkov writes: >> ld: /tmp/conftest-efc530.o: compiled for a big endian system and target is little endian >> ld: /tmp/conftest-efc530.o: endianness incompatible with that of the selected emulation > > This is the same problem we had on powerpc. Your binutils are set to > use little-endian output by default; we need to explicitly enable > either big or little endian in this case as well. Could you try > attached patch to verify? I'm glad to report that with your new patch, GRUB successfully builds on GuixSD mips64el with TARGET_CC=clang. I haven't yet tried booting it though. >> Your patch works for me with gcc, although config.log shows this warning >> when building the test program in your new code with the correct flags >> for gcc (-mabi=32): >> >> ld: warning: cannot find entry symbol __start; defaulting to 00000000004000d0 >> > > Well, I just reused existing checks in this case; we worry about it later. Okay. I guess the name of the start symbol depends on the platform and linker. E.g. boot/mips/loongson/fwstart.S has this: --8<---------------cut here---------------start------------->8--- .global start,_start,__start start: _start: __start: --8<---------------cut here---------------end--------------->8--- Other platforms have only '_start', or both 'start' and '_start'. >> I also worry that linking an O32 executable might be fragile on a pure >> non-multilib N32 system such as GNU Guix, where we lack even the gcc >> runtime library (libgcc_s) for O32. For now it seems to work, but I >> wonder if it might be more robust to do the test compilation with -c and >> -freestanding? >> > > It is using -nostdlib; is it not enough? The warning above makes me doubt the portability and future-proofness of the link step of this test. This problem could be avoided entirely by omitting the link step. The link step serves no purpose in this test, and is a potential source of portability problems. Having said that, if you prefer to keep the link step, I guess it will probably be okay in practice to define 'start', '_start', and '__start' as above. Do as you think best. Thanks for you help. Mark