summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-19 00:09:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-26 11:19:54 +0000
commit0afd3ac3ada35dd986aaf3be41d7177dc6b71ade (patch)
treea2339ca7d7a6a6a40a6baa853980c7559f1246c2
parentded63d68334044e79b15b814216fab02c70ad94f (diff)
downloadpoky-0afd3ac3ada35dd986aaf3be41d7177dc6b71ade.tar.gz
gcc: Drop gcc-cross-initial and use gcc-cross instead
We need a libgcc to build glibc. Tranditionally we therefore build a non-threaded and non-shared compiler (gcc-cross-initial), then use that to build libgcc-initial which is used to build glibc which we can then build gcc-cross and libgcc against. Firstly, we can drop the glibc dependency from gcc-cross, *if* we make two changes: a) specify the minimum glibc version to support in a configure option b) create a dummy limits.h file so that later when glibc creates one, the headers structure has support for it. We can do this with a simple empty file Once gcc-cross is libc independent, we can use it to build both libgcc-initial and then later libgcc. libgcc-initial is tricky as we need to imitate the non-threaded and non-shared case. We can do that by hacking the threading mode back to "single" even if gcc reports "posix" and disable libc presence for the libgcc-intial build. We have to create the dummy limits.h to avoid compiler errors from a missing header. glibc will fail to link with libgcc-initial due to a missing "exception handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need any exception handler, we can safely symlink to libgcc.a. With those changes, gcc-cross can be used in all places and we only need one build of gcc for each architecture. For some reason ifunc was being disabled on mips prior to these changes but afterwards became enabled but caused assertion failures. This is therefore disabled until we can debug that. (From OE-Core rev: 62b7308b8c4d2b439a15a4f7cbc6f823077bb0be) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/glibc/glibc.inc5
-rw-r--r--meta/recipes-devtools/gcc/gcc-configure-common.inc4
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-canadian.inc2
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross.inc8
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial.inc52
-rw-r--r--meta/recipes-devtools/gcc/libgcc.inc2
6 files changed, 62 insertions, 11 deletions
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index 43e71337ee..de692fbfd7 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -15,7 +15,7 @@ python () {
15 bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective)) 15 bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective))
16} 16}
17 17
18DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers" 18DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc-initial linux-libc-headers"
19 19
20PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc" 20PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
21PROVIDES += "virtual/libintl virtual/libiconv" 21PROVIDES += "virtual/libintl virtual/libiconv"
@@ -33,6 +33,9 @@ CACHED_CONFIGUREVARS += " \
33 libc_cv_ssp=no \ 33 libc_cv_ssp=no \
34" 34"
35 35
36# ifunc doesn't appear to work on mips, casuses libbfd assertion failures
37CACHED_CONFIGUREVARS_append_mipsarch = " libc_cv_ld_gnu_indirect_function=no"
38
36GLIBC_EXTRA_OECONF ?= "" 39GLIBC_EXTRA_OECONF ?= ""
37GLIBC_EXTRA_OECONF_class-nativesdk = "" 40GLIBC_EXTRA_OECONF_class-nativesdk = ""
38INHIBIT_DEFAULT_DEPS = "1" 41INHIBIT_DEFAULT_DEPS = "1"
diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc
index e2ce234aa1..0eecde6f17 100644
--- a/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -47,6 +47,10 @@ EXTRA_OECONF = "\
47 ${@get_gcc_multiarch_setting(bb, d)} \ 47 ${@get_gcc_multiarch_setting(bb, d)} \
48" 48"
49 49
50# glibc version is a minimum controlling whether features are enabled.
51# Doesn't need to track glibc exactly
52EXTRA_OECONF_append_libc-glibc = " --with-glibc-version=2.28 "
53
50# Set this here since GCC configure won't auto-detect and enable 54# Set this here since GCC configure won't auto-detect and enable
51# initfini-arry when cross compiling. 55# initfini-arry when cross compiling.
52EXTRA_OECONF_append = " --enable-initfini-array" 56EXTRA_OECONF_append = " --enable-initfini-array"
diff --git a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
index 2f32d3407f..73f1e05446 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -3,7 +3,7 @@ inherit cross-canadian
3SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)" 3SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
4PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}" 4PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5 5
6DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext flex-native" 6DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-${HOST_PREFIX}libc-for-gcc nativesdk-gettext flex-native virtual/libc"
7 7
8GCCMULTILIB = "--enable-multilib" 8GCCMULTILIB = "--enable-multilib"
9 9
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc
index 89b19684be..63a196e2e9 100644
--- a/meta/recipes-devtools/gcc/gcc-cross.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross.inc
@@ -2,7 +2,7 @@ inherit cross
2 2
3INHIBIT_DEFAULT_DEPS = "1" 3INHIBIT_DEFAULT_DEPS = "1"
4EXTRADEPENDS = "" 4EXTRADEPENDS = ""
5DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${EXTRADEPENDS} ${NATIVEDEPS}" 5DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}"
6PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" 6PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
7python () { 7python () {
8 if d.getVar("TARGET_OS").startswith("linux"): 8 if d.getVar("TARGET_OS").startswith("linux"):
@@ -44,6 +44,12 @@ EXTRA_OECONF_PATHS = "\
44 44
45ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" 45ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
46 46
47
48do_configure_prepend () {
49 install -d ${RECIPE_SYSROOT}${target_includedir}
50 touch ${RECIPE_SYSROOT}${target_includedir}/limits.h
51}
52
47do_compile () { 53do_compile () {
48 export CC="${BUILD_CC}" 54 export CC="${BUILD_CC}"
49 export AR_FOR_TARGET="${TARGET_SYS}-ar" 55 export AR_FOR_TARGET="${TARGET_SYS}-ar"
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}
diff --git a/meta/recipes-devtools/gcc/libgcc.inc b/meta/recipes-devtools/gcc/libgcc.inc
index 5f1dff609c..e4e0c48007 100644
--- a/meta/recipes-devtools/gcc/libgcc.inc
+++ b/meta/recipes-devtools/gcc/libgcc.inc
@@ -1,6 +1,6 @@
1require libgcc-common.inc 1require libgcc-common.inc
2 2
3DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" 3DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc"
4 4
5do_install_append_class-target () { 5do_install_append_class-target () {
6 if [ "${TCLIBC}" != "glibc" ]; then 6 if [ "${TCLIBC}" != "glibc" ]; then