diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-cross.inc')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-cross.inc | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-cross.inc b/meta/recipes-devtools/gcc/gcc-cross.inc index 6fa8c274cd..80b85fb054 100644 --- a/meta/recipes-devtools/gcc/gcc-cross.inc +++ b/meta/recipes-devtools/gcc/gcc-cross.inc | |||
@@ -2,8 +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 ${EXTRADEPENDS} ${NATIVEDEPS}" | 5 | DEPENDS = "virtual/cross-binutils ${EXTRADEPENDS} ${NATIVEDEPS}" |
6 | PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" | ||
7 | python () { | 6 | python () { |
8 | if d.getVar("TARGET_OS").startswith("linux"): | 7 | if d.getVar("TARGET_OS").startswith("linux"): |
9 | d.setVar("EXTRADEPENDS", "linux-libc-headers") | 8 | d.setVar("EXTRADEPENDS", "linux-libc-headers") |
@@ -21,8 +20,8 @@ require gcc-configure-common.inc | |||
21 | # gnu) will hit a QA failure. | 20 | # gnu) will hit a QA failure. |
22 | LINKER_HASH_STYLE ?= "sysv" | 21 | LINKER_HASH_STYLE ?= "sysv" |
23 | 22 | ||
24 | EXTRA_OECONF += "--enable-poison-system-directories" | 23 | EXTRA_OECONF += "--enable-poison-system-directories=error" |
25 | EXTRA_OECONF_append_sh4 = " \ | 24 | EXTRA_OECONF:append:sh4 = " \ |
26 | --with-multilib-list= \ | 25 | --with-multilib-list= \ |
27 | --enable-incomplete-targets \ | 26 | --enable-incomplete-targets \ |
28 | " | 27 | " |
@@ -31,20 +30,21 @@ EXTRA_OECONF += "\ | |||
31 | --with-system-zlib \ | 30 | --with-system-zlib \ |
32 | " | 31 | " |
33 | 32 | ||
34 | EXTRA_OECONF_append_libc-baremetal = " --without-headers" | 33 | EXTRA_OECONF:append:libc-baremetal = " --without-headers" |
35 | EXTRA_OECONF_remove_libc-baremetal = "--enable-threads=posix" | 34 | EXTRA_OECONF:remove:libc-baremetal = "--enable-threads=posix" |
36 | EXTRA_OECONF_remove_libc-newlib = "--enable-threads=posix" | 35 | EXTRA_OECONF:remove:libc-newlib = "--enable-threads=posix" |
36 | EXTRA_OECONF:remove:libc-picolibc = "--enable-threads=posix" | ||
37 | 37 | ||
38 | EXTRA_OECONF_PATHS = "\ | 38 | EXTRA_OECONF_PATHS = "\ |
39 | --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \ | 39 | --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \ |
40 | --with-gxx-libcxx-include-dir=/not/exist${target_includedir}/c++/v1 \ | ||
40 | --with-sysroot=/not/exist \ | 41 | --with-sysroot=/not/exist \ |
41 | --with-build-sysroot=${STAGING_DIR_TARGET} \ | 42 | --with-build-sysroot=${STAGING_DIR_TARGET} \ |
42 | " | 43 | " |
43 | 44 | ||
44 | ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" | 45 | ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}" |
45 | 46 | ||
46 | 47 | do_configure:prepend () { | |
47 | do_configure_prepend () { | ||
48 | install -d ${RECIPE_SYSROOT}${target_includedir} | 48 | install -d ${RECIPE_SYSROOT}${target_includedir} |
49 | touch ${RECIPE_SYSROOT}${target_includedir}/limits.h | 49 | touch ${RECIPE_SYSROOT}${target_includedir}/limits.h |
50 | } | 50 | } |
@@ -61,19 +61,8 @@ do_compile () { | |||
61 | export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" | 61 | export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}" |
62 | export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" | 62 | export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}" |
63 | 63 | ||
64 | # Prevent native/host sysroot path from being used in configargs.h header, | 64 | remove_sysroot_paths_from_configargs '/host' |
65 | # as it will be rewritten when used by other sysroots preventing support | 65 | remove_sysroot_paths_from_checksum_options '${STAGING_DIR_HOST}' '/host' |
66 | # for gcc plugins | ||
67 | oe_runmake configure-gcc | ||
68 | sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h | ||
69 | sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h | ||
70 | |||
71 | # Prevent sysroot/workdir paths from being used in checksum-options. | ||
72 | # checksum-options is used to generate a checksum which is embedded into | ||
73 | # the output binary. | ||
74 | oe_runmake TARGET-gcc=checksum-options all-gcc | ||
75 | sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options | ||
76 | sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options | ||
77 | 66 | ||
78 | oe_runmake all-host configure-target-libgcc | 67 | oe_runmake all-host configure-target-libgcc |
79 | (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) | 68 | (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) |
@@ -83,6 +72,8 @@ INHIBIT_PACKAGE_STRIP = "1" | |||
83 | 72 | ||
84 | # Compute how to get from libexecdir to bindir in python (easier than shell) | 73 | # Compute how to get from libexecdir to bindir in python (easier than shell) |
85 | BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" | 74 | BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}" |
75 | # linker plugin path | ||
76 | LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/bfd-plugins"))}" | ||
86 | 77 | ||
87 | do_install () { | 78 | do_install () { |
88 | ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h ) | 79 | ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h ) |
@@ -92,7 +83,7 @@ do_install () { | |||
92 | install -d ${D}${target_libdir} | 83 | install -d ${D}${target_libdir} |
93 | 84 | ||
94 | # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77 | 85 | # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77 |
95 | # gfortran is fully backwards compatible. This is a safe and practical solution. | 86 | # gfortran is fully backwards compatible. This is a safe and practical solution. |
96 | if [ -n "${@d.getVar('FORTRAN')}" ]; then | 87 | if [ -n "${@d.getVar('FORTRAN')}" ]; then |
97 | ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true | 88 | ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true |
98 | fortsymlinks="g77 gfortran" | 89 | fortsymlinks="g77 gfortran" |
@@ -102,7 +93,7 @@ do_install () { | |||
102 | # found. These need to be relative paths so they work in different locations. | 93 | # found. These need to be relative paths so they work in different locations. |
103 | dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ | 94 | dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ |
104 | install -d $dest | 95 | install -d $dest |
105 | for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do | 96 | for t in ar as ld ld.bfd nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do |
106 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t | 97 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t |
107 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t | 98 | ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t |
108 | done | 99 | done |
@@ -117,7 +108,11 @@ do_install () { | |||
117 | cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | 108 | cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ |
118 | cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ | 109 | cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ |
119 | 110 | ||
120 | find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f | 111 | cleanup_installed_include_fixed |
112 | |||
113 | # install LTO linker plugins where binutils tools can find it | ||
114 | install -d ${D}${libdir}/bfd-plugins | ||
115 | ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so | ||
121 | } | 116 | } |
122 | 117 | ||
123 | do_package[noexec] = "1" | 118 | do_package[noexec] = "1" |
@@ -143,6 +138,7 @@ do_gcc_stash_builddir () { | |||
143 | # Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files | 138 | # Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files |
144 | rm $dest/gcc/include/*.h | 139 | rm $dest/gcc/include/*.h |
145 | cp gcc/include/*.h $dest/gcc/include/ | 140 | cp gcc/include/*.h $dest/gcc/include/ |
141 | sysroot-relativelinks.py $dest | ||
146 | } | 142 | } |
147 | addtask do_gcc_stash_builddir after do_compile before do_install | 143 | addtask do_gcc_stash_builddir after do_compile before do_install |
148 | SSTATETASKS += "do_gcc_stash_builddir" | 144 | SSTATETASKS += "do_gcc_stash_builddir" |