blob: 06bf224f734e9691f42a28040282f9df4d2e28c9 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001#
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
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030require libgcc-common.inc
31
Brad Bishop19323692019-04-05 15:28:33 -040032DEPENDS = "virtual/${TARGET_PREFIX}gcc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033
34LICENSE = "GPL-3.0-with-GCC-exception"
35
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036PACKAGES = ""
37
38EXTRA_OECONF += "--disable-shared"
39
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050040inherit nopackages
Brad Bishop6e60e8b2018-02-01 10:27:11 -050041
42# We really only want this built by things that need it, not any recrdeptask
43deltask do_build
Brad Bishop19323692019-04-05 15:28:33 -040044
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}