summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/libgcc-initial.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/libgcc-initial.inc')
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial.inc52
1 files changed, 45 insertions, 7 deletions
diff --git a/meta/recipes-devtools/gcc/libgcc-initial.inc b/meta/recipes-devtools/gcc/libgcc-initial.inc
index 950ad861e7..06bf224f73 100644
--- a/meta/recipes-devtools/gcc/libgcc-initial.inc
+++ b/meta/recipes-devtools/gcc/libgcc-initial.inc
@@ -1,20 +1,58 @@
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
1require libgcc-common.inc 30require libgcc-common.inc
2 31
3DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial" 32DEPENDS = "virtual/${TARGET_PREFIX}gcc"
4 33
5LICENSE = "GPL-3.0-with-GCC-exception" 34LICENSE = "GPL-3.0-with-GCC-exception"
6 35
7STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
8STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
9PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
10
11PACKAGES = "" 36PACKAGES = ""
12 37
13EXTRA_OECONF += "--disable-shared" 38EXTRA_OECONF += "--disable-shared"
14 39
15COMPILERINITIAL = "-initial"
16
17inherit nopackages 40inherit nopackages
18 41
19# We really only want this built by things that need it, not any recrdeptask 42# We really only want this built by things that need it, not any recrdeptask
20deltask do_build 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}