Signed-off-by: Max Krummenacher <max.oss...@gmail.com> --- recipes-test/gcc-static-test/gcc-static-test.bb | 40 ++++++++++++++++++++++ .../gcc-static-test/gcc-static-test/hello.c | 6 ++++ 2 files changed, 46 insertions(+) create mode 100644 recipes-test/gcc-static-test/gcc-static-test.bb create mode 100644 recipes-test/gcc-static-test/gcc-static-test/hello.c
diff --git a/recipes-test/gcc-static-test/gcc-static-test.bb b/recipes-test/gcc-static-test/gcc-static-test.bb new file mode 100644 index 0000000..c0fd852 --- /dev/null +++ b/recipes-test/gcc-static-test/gcc-static-test.bb @@ -0,0 +1,40 @@ +SUMMARY = "Test if cross-gcc can compile a linked binary which runs on qemu" +DESCRIPTION = \ +"Have cross-gcc compile a simple helloworld style program linked statically \ +and dynamically and then test if qemu is able to run it without segfaulting. \ +Should help in hunting the following bug in building java: \ +http://lists.openembedded.org/pipermail/openembedded-devel/2015-January/099795.html" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +DEPENDS = "" + +SRC_URI = "file://hello.c" + +QEMU = "${@qemu_target_binary(d)} ${QEMU_OPTIONS} -s 2097152 -L ${STAGING_DIR_TARGET} -E LD_LIBRARY_PATH=${STAGING_BASELIBDIR}" + +trapsegfault() { + echo "We have a segmenation fault!" + + # Reset handler + trap - 11 +} + +do_compile() { + #disable the trap built into run.do_compile by default + set +e + trap '' 0 + trap 'trapsegfault' 11 + ${CC} -static hello.c -o hello + ${QEMU} hello ; FAILED_STATIC=$? + ${CC} hello.c -o hello + ${QEMU} hello ; FAILED_DYNAMIC=$? + echo FAILED_STATIC $FAILED_STATIC + echo FAILED_DYNAMIC $FAILED_DYNAMIC + ( [ $FAILED_STATIC -eq 0 ] && [ $FAILED_DYNAMIC -eq 0 ] ) || exit -1 +} + +S = "${WORKDIR}" + +inherit qemu diff --git a/recipes-test/gcc-static-test/gcc-static-test/hello.c b/recipes-test/gcc-static-test/gcc-static-test/hello.c new file mode 100644 index 0000000..5bd0da7 --- /dev/null +++ b/recipes-test/gcc-static-test/gcc-static-test/hello.c @@ -0,0 +1,6 @@ +#include <stdio.h> +int main (void) { + printf("Hi\n"); + return 0; +} + -- 1.9.3 -- _______________________________________________ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel