klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot

For the recipes built with klcc-cross it is necessary to
pass --sysroot otherwise we default to the one encoded in gcc-cross which
actually is the 'first one' built.
The issue was revealed when building for armv4 after having built for armv5te:
the produced binaries did contain Illegal Instruction (bx lr).

Use ${TOOLCHAIN_OPTIONS} variable to specify --sysroot=${STAGING_DIR_TARGET}

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Andrea Adami 2014-09-19 23:09:29 +02:00 committed by Martin Jansa
parent 2b32463cfc
commit 0a67b9f3fd
3 changed files with 17 additions and 2 deletions

View File

@ -4,8 +4,8 @@ DEPENDS =+ "klcc-cross"
# Default for klcc is to build static binaries.
# Set CC = "${TARGET_PREFIX}klcc -shared" to build the dynamic version.
export CC = "${TARGET_PREFIX}klcc"
export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc -march=armv4 -mthumb-interwork"
export CC = "${TARGET_PREFIX}klcc ${TOOLCHAIN_OPTIONS}"
export CC_armv4_linux-gnueabi = "${TARGET_PREFIX}klcc ${TOOLCHAIN_OPTIONS} -march=armv4 -mthumb-interwork"
export CPP = "${CC} -E"

View File

@ -0,0 +1,14 @@
diff --git a/klcc/klcc.in b/klcc/klcc.in
index 43d0984..61e9385 100644
--- a/klcc/klcc.in
+++ b/klcc/klcc.in
@@ -204,6 +204,9 @@ while ( defined($a = shift(@ARGV)) ) {
# Libraries
push(@libs, $a);
push(@libs, shift(@ARGV)) if ( $2 eq '' );
+ } elsif ( $a =~ /^--([sysroot=])(.*)$/ ) {
+ # Override gcc encoded sysroot
+ push(@ccopt, $a);
} else {
die "$0: unknown option: $a\n";
}

View File

@ -16,6 +16,7 @@ SRC_URI_append_linux-uclibceabi = " file://klibc-config-eabi.patch \
"
SRC_URI += "file://klibc-linux-libc-dev.patch \
file://staging.patch \
file://klcc-consider-sysroot.patch \
"
S = "${WORKDIR}/git"