[coreboot] cpu/amd/car/post_cache_as_ram.c: Build problems with GCC 4.8.x: `error: bp cannot be used in asm here`
paulepanter at users.sourceforge.net
Thu Oct 17 00:22:53 CEST 2013
Dear coreboot folks,
I submitted a bug report to GCC about the build failures we got with GCC
4.8.x¹. Björn Busse noticed that the ASUS M2V-MX SE did not build
anymore. (This was probably not detected by Jenkins because its coreboot
toolchain has to be updated manually.)
The code is in `src/cpu/amd/car/post_cache_as_ram.c` 
__asm__ volatile (
/* set new esp */ /* before CONFIG_RAMBASE */
"subl %0, %%esp\n\t"
::"a"( (CONFIG_DCACHE_RAM_BASE + CONFIG_DCACHE_RAM_SIZE)- (CONFIG_RAMTOP) )
/* discard all registers (eax is used for %0), so gcc redoes everything
after the stack is moved */
: "cc", "memory", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp"
and gcc throws the following error.
$ make V=1
/src/coreboot/util/crossgcc/xgcc/bin/i386-elf-gcc -Wa,--divide -fno-stack-protector -Wl,--build-id=none -MMD -Isrc -Isrc/include -Ibuild -Isrc/arch/x86/include -Isrc/device/oprom/include -include src/include/kconfig.h -Os -pipe -g -nostdinc -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wstrict-aliasing -Wshadow -Werror -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer -D__PRE_RAM__ -Isrc -I. -Ibuild -c -S src/mainboard/asus/m2v-mx_se/romstage.c -o build/mainboard/asus/m2v-mx_se/romstage.pre.inc
src/mainboard/asus/m2v-mx_se/romstage.c: In function 'pci_locate_device':
src/mainboard/asus/m2v-mx_se/romstage.c:196:1: internal compiler error: Illegal instruction
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [build/mainboard/asus/m2v-mx_se/romstage.pre.inc] Error 1
The verbose error is `error: bp cannot be used in asm here`.
The offending code lies in and therefore the patch was reverted by
Patrick Georgi in commit c8883262 (buildgcc: Downgrade to gcc 4.7.3,
handle armv7-a) .
My ticket 58758  was closed right away as invalid by Andrew Pinski
and he linked to bug 11807 . Furthermore he replied the following
about the code used in coreboot.
This code really should be written in pure asm rather than doing
an inline-asm as GCC can do many different optimizations more
than just rereading them from the stack.
So it looks like GCC is not going to be changed/fixed and, if we wanted
to update coreboot’s toolchain, we would need to fix our code.
¹ Sometimes it fails for me with 4.7.3 too. I do not know why, but it
might be related to `.xcompile` not having some flags it should have.
This is another problem though.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 198 bytes
Desc: This is a digitally signed message part
More information about the coreboot