From owner-freebsd-current@FreeBSD.ORG Fri Feb 22 20:49:26 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 26BE469D; Fri, 22 Feb 2013 20:49:26 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) by mx1.freebsd.org (Postfix) with ESMTP id C362DA9B; Fri, 22 Feb 2013 20:49:25 +0000 (UTC) Received: from [192.168.0.6] (spaceball.home.andric.com [192.168.0.6]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 0043E5C43; Fri, 22 Feb 2013 21:49:20 +0100 (CET) Message-ID: <5127D9D2.3000508@andric.com> Date: Fri, 22 Feb 2013 21:49:22 +0100 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20130117 Thunderbird/19.0 MIME-Version: 1.0 To: lev@FreeBSD.org Subject: Re: r245741 (clang as cc) can not build binaries for GEODE processor References: <108875110.20130222104603@serebryakov.spb.ru> <51277EFE.4000703@andric.com> <15917508.20130222194954@serebryakov.spb.ru> <5127997A.2000901@andric.com> <781694121.20130222235742@serebryakov.spb.ru> In-Reply-To: <781694121.20130222235742@serebryakov.spb.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 20:49:26 -0000 On 2013-02-22 20:57, Lev Serebryakov wrote: ... > Program terminated with signal 4, Illegal instruction. > Reading symbols from /lib/libc.so.7...done. > Loaded symbols for /lib/libc.so.7 > Reading symbols from /libexec/ld-elf.so.1...done. > Loaded symbols for /libexec/ld-elf.so.1 > #0 0x080483e9 in _start1 () > (gdb) where > #0 0x080483e9 in _start1 () > #1 0x08048398 in _start () > #2 0x00000000 in ?? () > (gdb) x/i $pc > 0x80483e9 <_start1+73>: nopl 0x0(%eax) Ah yes, I see that is in crt1.o. Some of the lib/csu files are built in a special way: for example, the crt1_c.c file is compiled to crt1_c.s, then the crt1_c.s file file is modified with sed, and lastly the crt1_c.s file is assembled to crt1_c.o: cc -O2 -pipe -I/usr/src/lib/csu/i386-elf/../common -I/usr/src/lib/csu/i386-elf/../../libc/include -std=gnu99 -Qunused-arguments -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -S -o crt1_c.s /usr/src/lib/csu/i386-elf/crt1_c.c sed -i "" -e '/\.note\.tag/s/progbits/note/' crt1_c.s cc -c -o crt1_c.o crt1_c.s For some reason, however, in the last step, the default target CPU (i486) is not passed to the assembler stage: $ cc -v -c -o crt1_c.o crt1_c.s FreeBSD clang version 3.2 (tags/RELEASE_32/final 170710) 20121221 Target: i386-unknown-freebsd10.0 Thread model: posix "/usr/bin/cc" -cc1as -triple i386-unknown-freebsd10.0 -filetype obj -o crt1_c.o crt1_c.s and that seems to be why it still inserts log nops there. It is a problem with -cc1as, and I have reported it to upstream, there should hopefully be a fix soon. As a workaround for now, can you please try to build and install lib/csu with the following added to your environment, make.conf or src.conf: ACFLAGS=-Wa,-target-cpu,geode or alternatively: ACFLAGS=-Wa,-target-cpu,i486 whichever you prefer. Then rebuild your test program, and try running it again. If that seems to work, it is probably safest to rebuild world and kernel with those ACFLAGS settings as the next step, and install them. -Dimitry