r245741 (clang as cc) can not build binaries for GEODE processor
Dimitry Andric
dimitry at andric.com
Fri Feb 22 20:49:26 UTC 2013
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
More information about the freebsd-current
mailing list