diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-19 00:09:14 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-12-26 11:19:54 +0000 |
commit | 0afd3ac3ada35dd986aaf3be41d7177dc6b71ade (patch) | |
tree | a2339ca7d7a6a6a40a6baa853980c7559f1246c2 /meta/recipes-devtools/gcc | |
parent | ded63d68334044e79b15b814216fab02c70ad94f (diff) | |
download | poky-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>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-configure-common.inc | 4 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross-canadian.inc | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross.inc | 8 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/libgcc-initial.inc | 52 | ||||
-rw-r--r-- | meta/recipes-devtools/gcc/libgcc.inc | 2 |
5 files changed, 58 insertions, 10 deletions
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 | ||
52 | EXTRA_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. |
52 | EXTRA_OECONF_append = " --enable-initfini-array" | 56 | EXTRA_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 | |||
3 | SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)" | 3 | SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)" |
4 | PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}" | 4 | PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}" |
5 | 5 | ||
6 | DEPENDS = "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" | 6 | DEPENDS = "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 | ||
8 | GCCMULTILIB = "--enable-multilib" | 8 | GCCMULTILIB = "--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 | ||
3 | INHIBIT_DEFAULT_DEPS = "1" | 3 | INHIBIT_DEFAULT_DEPS = "1" |
4 | EXTRADEPENDS = "" | 4 | EXTRADEPENDS = "" |
5 | DEPENDS = "virtual/${TARGET_PREFIX}binutils virtual/${TARGET_PREFIX}libc-for-gcc ${EXTRADEPENDS} ${NATIVEDEPS}" | 5 | DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}" |
6 | PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" | 6 | PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" |
7 | python () { | 7 | python () { |
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 | ||
45 | ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" | 45 | ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" |
46 | 46 | ||
47 | |||
48 | do_configure_prepend () { | ||
49 | install -d ${RECIPE_SYSROOT}${target_includedir} | ||
50 | touch ${RECIPE_SYSROOT}${target_includedir}/limits.h | ||
51 | } | ||
52 | |||
47 | do_compile () { | 53 | do_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 | |||
1 | require libgcc-common.inc | 30 | require libgcc-common.inc |
2 | 31 | ||
3 | DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial" | 32 | DEPENDS = "virtual/${TARGET_PREFIX}gcc" |
4 | 33 | ||
5 | LICENSE = "GPL-3.0-with-GCC-exception" | 34 | LICENSE = "GPL-3.0-with-GCC-exception" |
6 | 35 | ||
7 | STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" | ||
8 | STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" | ||
9 | PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" | ||
10 | |||
11 | PACKAGES = "" | 36 | PACKAGES = "" |
12 | 37 | ||
13 | EXTRA_OECONF += "--disable-shared" | 38 | EXTRA_OECONF += "--disable-shared" |
14 | 39 | ||
15 | COMPILERINITIAL = "-initial" | ||
16 | |||
17 | inherit nopackages | 40 | inherit 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 |
20 | deltask do_build | 43 | deltask do_build |
44 | |||
45 | do_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 | |||
52 | do_configure_append () { | ||
53 | sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile | ||
54 | } | ||
55 | |||
56 | do_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 @@ | |||
1 | require libgcc-common.inc | 1 | require libgcc-common.inc |
2 | 2 | ||
3 | DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" | 3 | DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc" |
4 | 4 | ||
5 | do_install_append_class-target () { | 5 | do_install_append_class-target () { |
6 | if [ "${TCLIBC}" != "glibc" ]; then | 6 | if [ "${TCLIBC}" != "glibc" ]; then |