[coreboot] New patch to review for coreboot: 9c93926 libpayload: get sample to cross-build for ARMV7 (finally!)
Ronald G. Minnich (rminnich@gmail.com)
gerrit at coreboot.org
Fri Feb 15 18:03:39 CET 2013
Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2413
-gerrit
commit 9c93926ae484e708ef1f381749d9a35bcd14b664
Author: Ronald G. Minnich <rminnich at gmail.com>
Date: Fri Feb 15 08:48:25 2013 -0800
libpayload: get sample to cross-build for ARMV7 (finally!)
libpayload was not capable of cross-building payloads.
This is a proposed change to make it work.
Add a top-level file that is specifically designed for payloads:
payloadbuild.inc.
Change the payload (e.g. sample/Makefile) Makefile to
1. define the top level in a variable, top
2. include $(top)/.xcompile to get the variables
(I think we may want the option of including/not including this file
in a payload Makefile -- do we?)
3. include $(top)/payloadbuild.inc
You don't want to include all the *.inc files that libpayload itself
builds in a payload, because that brings in lots of stuff you really
don't want. Hence a special file, payloadbuild.inc, oriented to
building payloads.
I add a segment in the ldscript for the GNU issues with arm
(for some sense of what a mess this is, see, e.g.,
http://stackoverflow.com/questions/9752000/exidx-start-and-exidx-end-what-do-they-do
to make an empty array for exception indexes. We may need to fix this
up more later. I'm not sure it's bad to have an empty array, however.
Also make abort() a function, not a macro, because the runtime wants a
function.
At this point, we've finally get a building payload, although we fail
on a missing serial port (that's next).
In this case, a certain amount of bikeshedding is expected *and*
encouraged.
Change-Id: If1ec0276b13f6d5f05cb88bb413791c4d90b7392
Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
payloads/libpayload/arch/armv7/libpayload.ldscript | 5 +++++
payloads/libpayload/include/stdlib.h | 4 +++-
payloads/libpayload/libc/lib.c | 5 +++++
payloads/libpayload/sample/Makefile | 8 ++++++--
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/payloads/libpayload/arch/armv7/libpayload.ldscript b/payloads/libpayload/arch/armv7/libpayload.ldscript
index 5f65bd7..98ba97a 100644
--- a/payloads/libpayload/arch/armv7/libpayload.ldscript
+++ b/payloads/libpayload/arch/armv7/libpayload.ldscript
@@ -61,6 +61,11 @@ SECTIONS
*(.data.*)
}
+ .ARM.exidx : {
+ __exidx_start = .;
+ __exidx_end = .;
+ }
+
_edata = .;
.bss : {
diff --git a/payloads/libpayload/include/stdlib.h b/payloads/libpayload/include/stdlib.h
index cf37c80..97961d5 100644
--- a/payloads/libpayload/include/stdlib.h
+++ b/payloads/libpayload/include/stdlib.h
@@ -139,7 +139,9 @@ void srand(unsigned int seed);
*/
void halt(void) __attribute__ ((noreturn));
void exit(int status) __attribute__ ((noreturn));
-#define abort() halt() /**< Alias for the halt() function */
+
+/* needed as a symbol for ARM runtime */
+void abort(void) __attribute__ ((noreturn));
/** @} */
diff --git a/payloads/libpayload/libc/lib.c b/payloads/libpayload/libc/lib.c
index 616a7c6..85b8a3e 100644
--- a/payloads/libpayload/libc/lib.c
+++ b/payloads/libpayload/libc/lib.c
@@ -126,3 +126,8 @@ char *getenv(const char *name)
return NULL;
}
+void abort(void)
+{
+ halt();
+}
+
diff --git a/payloads/libpayload/sample/Makefile b/payloads/libpayload/sample/Makefile
index 1a32f3b..3d0b69c 100644
--- a/payloads/libpayload/sample/Makefile
+++ b/payloads/libpayload/sample/Makefile
@@ -27,10 +27,14 @@
## SUCH DAMAGE.
##
+top=..
+include $(top)/.xcompile
+include $(top)/payloadbuild.inc
+
# Sample libpayload Makefile.
LIBPAYLOAD_DIR := ../install/libpayload
-XCC := CC=$(CC) $(LIBPAYLOAD_DIR)/bin/lpgcc
-XAS := AS=$(AS) $(LIBPAYLOAD_DIR)/bin/lpas
+XCC := CC='$(CC)' $(LIBPAYLOAD_DIR)/bin/lpgcc
+XAS := AS='$(AS)' $(LIBPAYLOAD_DIR)/bin/lpas
CFLAGS := -Wall -Werror -Os
TARGET := hello
OBJS := $(TARGET).o
More information about the coreboot
mailing list