1# 2# Notes on the way the OE cross toolchain now works 3# 4# We need a libgcc to build glibc. Tranditionally we therefore built 5# a non-threaded and non-shared compiler (gcc-cross-initial), then use 6# that to build libgcc-initial which is used to build glibc which we can 7# then build gcc-cross and libgcc against. 8# 9# We were able to drop the glibc dependency from gcc-cross, with two tweaks: 10 11# a) specify the minimum glibc version to support in a configure option 12# b) create a dummy limits.h file so that later when glibc creates one, 13# the headers structure has support for it. We can do this with a simple 14# empty file 15# 16# Once gcc-cross is libc independent, we can use it to build both 17# libgcc-initial and then later libgcc. 18# 19# libgcc-initial is tricky as we need to imitate the non-threaded and 20# non-shared case. We can do that by hacking the threading mode back to 21# "single" even if gcc reports "posix" and disable libc presence for the 22# libgcc-intial build. We have to create the dummy limits.h to avoid 23# compiler errors from a missing header. 24# 25# glibc will fail to link with libgcc-initial due to a missing "exception 26# handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need 27# any exception handler, we can safely symlink to libgcc.a. 28# 29 30require libgcc-common.inc 31 32DEPENDS = "virtual/${TARGET_PREFIX}gcc" 33 34LICENSE = "GPL-3.0-with-GCC-exception" 35 36PACKAGES = "" 37 38EXTRA_OECONF += "--disable-shared" 39 40inherit nopackages 41 42# We really only want this built by things that need it, not any recrdeptask 43deltask do_build 44 45do_configure:prepend () { 46 install -d ${STAGING_INCDIR} 47 touch ${STAGING_INCDIR}/limits.h 48 sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars 49 sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile 50} 51 52do_configure:append () { 53 sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile 54} 55 56do_install:append () { 57 ln -s libgcc.a ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc_eh.a 58} 59