[coreboot] romcc issue with loop execution?

Alex G. mr.nuke.me at gmail.com
Wed Jan 20 19:05:57 CET 2016

On 01/20/2016 09:23 AM, Andrey Korolyov wrote:
> Hello,
> during initial bootstrap of an ancient Geode board I found that the
> romstage hangs at

After observing several issues with romcc, when the same code worked as
expected with GCC, our team decided to discontinue use of ROMCC. It was
determined it would be less effort to write all of the bootblock in
assembly than to work around romcc issues. romcc was issuing nonsensical
instructions, like "mov eax, eax".

You could try to disassemble your bootblock with "objdump -d" and see if
the resulting code makes sense.

> src/northbridge/amd/lx/raminit.c:
>     750         volatile unsigned long *ptr;
>     751         for (i = 0; i < 5; i++) {
>     752                 ptr = (void *)i;
>     753                 *ptr = (unsigned long)i;

Well, the first iteration of the loop causes a NULL pointer dereference.
If that's not enough, you also have three unaligned 32-bit writes.  I'm
not sure how well romcc understands undefined behavior, but disassemby
is your best friend here. Make sure the resulting asm does what you
think the C code tells it to do.


More information about the coreboot mailing list