[coreboot] build failure: cannot move location counter backwards

Stefan Reinauer reinauer at google.com
Tue Jun 21 00:54:20 CEST 2011

Hi Darren,

* Darren Hart <dvhart at linux.intel.com> [110621 00:19]:
> I'm new to coreboot and just trying to get it to boot into qemu. I've
> tried using SeaBios as well as just copying "yes" to payload.elf. I
> updated the Makefile to use gcc 4.5 instead of the 4.4 that ships with
> my distribution (Ubuntu 10.10):
> Index: Makefile
> ===================================================================
> --- Makefile	(revision 6637)
> +++ Makefile	(working copy)
> @@ -64,7 +64,7 @@
>  endif
>  endif
> -HOSTCC = gcc
> +HOSTCC = gcc-4.5
>  HOSTCXX = g++
>  HOSTCFLAGS := -I$(srck) -I$(objk) -g
>  HOSTCXXFLAGS := -I$(srck) -I$(objk)

This will only change the compiler used to compile your userland
utilities. You need to change the script util/xcompile/xcompile to get
the target compiler changed. (And possibly delete the file .xcompile in
your coreboot directory before trying again)

>     CC         coreboot_ram
> src/arch/x86/coreboot_ram.ld:129 cannot move location counter backwards
> (from 0000000000118000 to 0000000000004000)
> collect2: ld returned 1 exit status
> make: *** [build/coreboot_ram] Error 1

This is a common tool chain bug we hit mostly on Ubuntu based systems so
far. (Maybe someone could open a bug report so they know about this

So far, the easiest way to get a known good toolchain is to build the
coreboot reference toolchain. It should build out of the box on any
Linux, MacOSX (with Xcode and MacPorts installed) and Windows (with
MINGW or Cygwin installed) system. To build it, go to util/crossgcc in
your coreboot tree and run the buildgcc script:

$ ./buildgcc

Then sit back and wait for a few minutes for the build to finish.

The resulting toolchain will per default end up in util/crossgcc/xgcc
and will be automatically picked up by the coreboot build system. Again,
you should delete your coreboot/.xcompile file after making changes to
the toolchain.

Hope that helps,


More information about the coreboot mailing list