[coreboot] [PATCH] Fix bayou payload execution

Ulf Jordan jordan at chalmers.se
Sun Nov 9 10:41:21 CET 2008


Bayou svn HEAD cannot execute its payloads correctly, due to payloads 
overwriting bayou in memory. This is in turn due to the lpgcc link run 
trying to apply both libpayload's and bayou's ldscripts.

The two attached patches a) makes lpgcc's choice of ldscript overridable 
and b) adjusts bayou's ldscript to work with the recent MB changes in 
libpayload.

Compile and runtime tested with bayou, coreinfo and coreboot-v3 in QEMU.


/ulf
-------------- next part --------------
Fix bayou payload execution.

Bayou must link with its own ldscript to end up at a load address that
doesn't interfere with payloads. Make Bayou's ldscript MB compatible, so
the link with libpayload/lib/i386/head.o succeeds.

Signed-off-by: Ulf Jordan <jordan at chalmers.se>

Index: bayou/bayou.ldscript
===================================================================
--- bayou/bayou.ldscript	(revision 3737)
+++ bayou/bayou.ldscript	(arbetskopia)
@@ -60,6 +60,8 @@
 		*(.data.*)
 	}
 
+	_edata = .;
+
 	.bss : {
 		*(.bss)
 		*(.bss.*)
-------------- next part --------------
Fix bayou payload execution.

Bayou must link with its own ldscript to end up at a load address that
doesn't interfere with payloads. Make lpgcc's choice of ldscript overridable.

Signed-off-by: Ulf Jordan <jordan at chalmers.se>

Index: libpayload/bin/lpgcc
===================================================================
--- libpayload/bin/lpgcc	(revision 3737)
+++ libpayload/bin/lpgcc	(arbetskopia)
@@ -39,6 +39,8 @@
 # This will set the _LIBDIR and _INCDIR variables used below
 . $BASE/lp.functions
 
+_LDSCRIPT="-Wl,-T,$_LIBDIR/libpayload.ldscript"
+
 trygccoption() {
 	$DEFAULT_CC $1 -S -xc /dev/null -o .$$.tmp &> /dev/null
 	RET=$?
@@ -73,6 +75,11 @@
 		shift
 		continue
 		;;
+	    -Wl,-T,*)
+		_LDSCRIPT="$1"
+		shift
+		continue
+		;;
 	    *)
 		;;
 	esac
@@ -90,7 +97,7 @@
 
 _CFLAGS="$_CFLAGS -I`$DEFAULT_CC -m32 -print-search-dirs | head -n 1 | cut -d' ' -f2`include"
 
-_LDFLAGS="-Wl,-T,$_LIBDIR/libpayload.ldscript -static"
+_LDFLAGS="$_LDSCRIPT -static"
 
 if [ $DOLINK -eq 0 ]; then
     if [ $DEBUGME -eq 1 ]; then


More information about the coreboot mailing list