]> code.ossystems Code Review - openembedded-core.git/commitdiff
gcc/libc: Change bootstrap to use an intermediate sysroot and hence no longer overwri...
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 25 Jan 2011 00:34:09 +0000 (00:34 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 25 Jan 2011 12:25:45 +0000 (12:25 +0000)
Based upon patches from Dexuan Cui <dexuan.cui@intel.com>

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/siteconfig.bbclass
meta/conf/bitbake.conf
meta/recipes-core/eglibc/eglibc-initial.inc
meta/recipes-core/eglibc/eglibc.inc
meta/recipes-core/glibc/glibc-initial.inc
meta/recipes-core/glibc/glibc.inc
meta/recipes-devtools/gcc/gcc-cross-intermediate.inc

index e7cc9ae0dab40be985f27f38e70253622d063ad8..5edc0d6a0bae892503d41033c72ddb8d7e113dde 100644 (file)
@@ -10,13 +10,15 @@ python siteconfig_do_siteconfig () {
        sstate_install(shared_state, d)
 }
 
+EXTRASITECONFIG ?= ""
+
 siteconfig_do_siteconfig_gencache () {
        mkdir -p ${WORKDIR}/site_config
        gen-site-config ${FILE_DIRNAME}/site_config \
                >${WORKDIR}/site_config/configure.ac
        cd ${WORKDIR}/site_config
        autoconf
-        CONFIG_SITE="" ./configure ${CONFIGUREOPTS} --cache-file ${PN}_cache
+        CONFIG_SITE="" ${EXTRASITECONFIG} ./configure ${CONFIGUREOPTS} --cache-file ${PN}_cache
        sed -n -e "/ac_cv_c_bigendian/p" -e "/ac_cv_sizeof_/p" \
                -e "/ac_cv_type_/p" -e "/ac_cv_header_/p" -e "/ac_cv_func_/p" \
                < ${PN}_cache > ${PN}_config
index 19ec1a7ce7e2655f6feec8b432e421c6e31585bd..1c6c7e5f12c842a3b1e2ef6d39bf66ae54eda7fc 100644 (file)
@@ -293,6 +293,7 @@ STAGING_PYDIR = "${STAGING_DIR}/lib/python2.4"
 # This should really be MULTIMACH_TARGET_SYS but that breaks "all" and machine 
 # specific packages - hack around it for now.
 STAGING_DIR_TARGET = "${STAGING_DIR}/${BASEPKG_TARGET_SYS}"
+STAGING_DIR_TCBOOTSTRAP = "${STAGING_DIR_TARGET}-tcbootstrap"
 
 # Setting DEPLOY_DIR outside of TMPDIR is helpful, when you are using
 # packaged staging and/or multimachine.
index cb50e89226700b02f255c545be8682b503829a0d..ce85d99096fcc0e360d11b11329e33b9938f224d 100644 (file)
@@ -45,8 +45,15 @@ do_install () {
        install -m 644 csu/crt[1in].o ${D}${libdir}
        ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
                -o ${D}${libdir}/libc.so
+
+       # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
+       for t in linux asm asm-generic; do
+               ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
+       done
 }
 
 do_siteconfig () {
        :
 }
+
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"
index 63c313ca48ae1c217c7b55754a43ee7dee680f74..8314cb1548316ec5266715a5129683cc16974f16 100644 (file)
@@ -4,6 +4,21 @@ STAGINGCC = "gcc-cross-intermediate"
 STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-intermediate"
 PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
 
+TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
+
+# siteconfig.bbclass runs configure which needs a working compiler
+# For the compiler to work we need a working libc yet libc isn't 
+# in the sysroots directory at this point. This means the libc.so
+# linker script won't work as the --sysroot setting isn't correct.
+# Here we create a hacked up libc linker script and pass in the right
+# flags to let configure work. Ugly.
+EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
+siteconfig_do_siteconfig_gencache_prepend = " \
+       mkdir -p ${WORKDIR}/site_config_libc; \
+       cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
+       sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
+"
+
 # nptl needs unwind support in gcc, which can't be built without glibc.
 DEPENDS = "virtual/${TARGET_PREFIX}gcc-intermediate linux-libc-headers"
 #this leads to circular deps, so lets not add it yet
index 99aa05fab76924c48cc76402a985a2d15d7e0f18..3745955f60e75c40435a466b439e0b5bbd09c8ea 100644 (file)
@@ -53,8 +53,15 @@ do_install () {
        install -m 644 csu/crt[1in].o ${D}${libdir}
        ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
                -o ${D}${libdir}/libc.so
+
+       # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
+       for t in linux asm asm-generic; do
+               ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
+       done
 }
 
 do_siteconfig () {
        :
 }
+
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"
index cdfa06de90f0542a20317c8a67d9ea0c5faf39c7..127ae231d75741b8107fdf4b17a444cab88b8be2 100644 (file)
@@ -21,6 +21,21 @@ STAGINGCC = "gcc-cross-intermediate"
 STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-intermediate"
 PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
 
+TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
+
+# siteconfig.bbclass runs configure which needs a working compiler
+# For the compiler to work we need a working libc yet libc isn't
+# in the sysroots directory at this point. This means the libc.so
+# linker script won't work as the --sysroot setting isn't correct.
+# Here we create a hacked up libc linker script and pass in the right
+# flags to let configure work. Ugly.
+EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
+siteconfig_do_siteconfig_gencache_prepend = " \
+       mkdir -p ${WORKDIR}/site_config_libc; \
+       cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
+       sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
+"
+
 inherit autotools
 
 GLIBC_EXTRA_OECONF ?= ""
index 12fdb70ae8dbd4674abd3429922ba35dfd829859..01571a32026611c54fcc2db6cb5562b44be2dc33 100644 (file)
@@ -14,13 +14,13 @@ EXTRA_OECONF = "--with-local-prefix=${STAGING_DIR_TARGET}${target_prefix} \
                --enable-languages=c \
                 ${OPTSPACE} \
                --program-prefix=${TARGET_PREFIX} \
-               --with-sysroot=${STAGING_DIR_TARGET} \
-               --with-build-sysroot=${STAGING_DIR_TARGET} \
+               --with-sysroot=${STAGING_DIR_TCBOOTSTRAP} \
+               --with-build-sysroot=${STAGING_DIR_TCBOOTSTRAP} \
                ${EXTRA_OECONF_INTERMEDIATE} \
                ${@get_gcc_fpu_setting(bb, d)}"
 
 do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST} ${SYSROOT_DESTDIR}/${STAGING_DIR_TARGET}/${target_base_libdir}"
-do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST} ${STAGING_DIR_TARGET}/${target_base_libdir}"
+do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST} ${STAGING_DIR_TCBOOTSTRAP}/${target_base_libdir}"
 
 do_compile () {
     oe_runmake