[oe-commits] Andrea Adami : klibc: klcc: consider --sysroot option and override gcc-cross encoded sysroot

git at git.openembedded.org git at git.openembedded.org
Wed Sep 24 15:23:46 UTC 2014


Module: meta-openembedded.git
Branch: master-next
Commit: 5dde5f91f3b419bef1c8164409f15d709c7472dc
URL:    http://git.openembedded.org/?p=meta-openembedded.git&a=commit;h=5dde5f91f3b419bef1c8164409f15d709c7472dc

Author: Andrea Adami <andrea.adami at gmail.com>
Date:   Fri Sep 19 23:09:29 2014 +0200

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 at gmail.com>
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>

---

 meta-initramfs/classes/klibc.bbclass                       |  4 ++--
 .../klibc/klibc-2.0.4/klcc-consider-sysroot.patch          | 14 ++++++++++++++
 meta-initramfs/recipes-devtools/klibc/klibc.inc            |  1 +
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/meta-initramfs/classes/klibc.bbclass b/meta-initramfs/classes/klibc.bbclass
index ca741cd..f864104 100644
--- a/meta-initramfs/classes/klibc.bbclass
+++ b/meta-initramfs/classes/klibc.bbclass
@@ -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"
 
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
new file mode 100644
index 0000000..9bc4835
--- /dev/null
+++ b/meta-initramfs/recipes-devtools/klibc/klibc-2.0.4/klcc-consider-sysroot.patch
@@ -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";
+     }
diff --git a/meta-initramfs/recipes-devtools/klibc/klibc.inc b/meta-initramfs/recipes-devtools/klibc/klibc.inc
index 0209b20..f3e9972 100644
--- a/meta-initramfs/recipes-devtools/klibc/klibc.inc
+++ b/meta-initramfs/recipes-devtools/klibc/klibc.inc
@@ -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"



More information about the Openembedded-commits mailing list