blob: dbc9141000df065a94f664b744279c927bb2b055 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require gcc-configure-common.inc
2
Patrick Williamsc0f7c042017-02-23 20:41:17 -06003SUMMARY = "Runtime libraries from GCC"
4
Andrew Geisslerd5838332022-05-27 11:33:10 -05005# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05006# All gcc-runtime packages are now covered by the runtime exception.
7LICENSE = "GPL-3.0-with-GCC-exception"
8
Patrick Williams213cb262021-08-07 19:21:33 -05009CXXFLAGS:remove = "-fvisibility-inlines-hidden"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010
11EXTRA_OECONF_PATHS = "\
12 --with-gxx-include-dir=${includedir}/c++/${BINV} \
13 --with-sysroot=/not/exist \
14 --with-build-sysroot=${STAGING_DIR_TARGET} \
15"
16
Patrick Williams213cb262021-08-07 19:21:33 -050017EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
18EXTRA_OECONF:append = " --cache-file=${B}/config.cache"
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050019EXTRA_OECONF:append:libc-newlib = " --with-newlib --with-target-subdir"
20EXTRA_OECONF:append:libc-baremetal = " --with-target-subdir"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021
Brad Bishop08902b02019-08-20 09:16:51 -040022# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
Patrick Williams213cb262021-08-07 19:21:33 -050023EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no "
24EXTRA_OECONF:append:armeb = " libat_cv_have_ifunc=no "
Andrew Geissler82c905d2020-04-13 13:39:40 -050025
Patrick Williams213cb262021-08-07 19:21:33 -050026DISABLE_STATIC:class-nativesdk ?= ""
Andrew Geissler82c905d2020-04-13 13:39:40 -050027
28# Newlib does not support symbol versioning on libsdtcc++
Patrick Williams213cb262021-08-07 19:21:33 -050029SYMVERS_CONF:libc-newlib = ""
Brad Bishop08902b02019-08-20 09:16:51 -040030
31# Building with thumb enabled on armv6t fails
Patrick Williams213cb262021-08-07 19:21:33 -050032ARM_INSTRUCTION_SET:armv6 = "arm"
Brad Bishop08902b02019-08-20 09:16:51 -040033
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050034RUNTIMELIBITM = "libitm"
Patrick Williams213cb262021-08-07 19:21:33 -050035RUNTIMELIBITM:arc = ""
36RUNTIMELIBITM:mipsarch = ""
37RUNTIMELIBITM:nios2 = ""
38RUNTIMELIBITM:microblaze = ""
39RUNTIMELIBITM:riscv32 = ""
40RUNTIMELIBITM:riscv64 = ""
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050041RUNTIMELIBITM:loongarch64 = ""
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080042RUNTIMELIBSSP ?= ""
Patrick Williams213cb262021-08-07 19:21:33 -050043RUNTIMELIBSSP:mingw32 ?= "libssp"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050044
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080045RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050046 ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
47"
Andrew Geissler82c905d2020-04-13 13:39:40 -050048# Only build libstdc++ for newlib
Patrick Williams213cb262021-08-07 19:21:33 -050049RUNTIMETARGET:libc-newlib = "libstdc++-v3"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050050
Patrick Williamsc124f4f2015-09-15 14:41:29 -050051# libiberty
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052# libgfortran needs separate recipe due to libquadmath dependency
53
54do_configure () {
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000055 export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib"
56 # libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
57 # tests. Create a dummy empty lib for the purposes of configure.
58 mkdir -p ${WORKDIR}/dummylib
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050059 ${CC} -x c /dev/null -c -o ${WORKDIR}/dummylib/dummylib.o
60 ${AR} rcs ${WORKDIR}/dummylib/libstdc++.a ${WORKDIR}/dummylib/dummylib.o
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061 for d in libgcc ${RUNTIMETARGET}; do
62 echo "Configuring $d"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063 rm -rf ${B}/${TARGET_SYS}/$d/
64 mkdir -p ${B}/${TARGET_SYS}/$d/
65 cd ${B}/${TARGET_SYS}/$d/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066 chmod a+x ${S}/$d/configure
Patrick Williams92b42cb2022-09-03 06:53:57 -050067 ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
Brad Bishopd7bf8c12018-02-25 22:55:05 -050068 if [ "$d" = "libgcc" ]; then
69 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
70 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071 done
72}
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073EXTRACONFFUNCS += "extract_stashed_builddir"
74do_configure[depends] += "${COMPILERDEP}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075
76do_compile () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077 for d in libgcc ${RUNTIMETARGET}; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -050078 cd ${B}/${TARGET_SYS}/$d/
79 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/
Patrick Williamsc124f4f2015-09-15 14:41:29 -050080 done
81}
82
83do_install () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084 for d in ${RUNTIMETARGET}; do
Brad Bishop6e60e8b2018-02-01 10:27:11 -050085 cd ${B}/${TARGET_SYS}/$d/
86 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087 done
Patrick Williams73bd93f2024-02-20 08:07:48 -060088 install -d ${D}${datadir}/gdb/auto-load/${libdir}
89 mv ${D}${libdir}/libstdc++*-gdb.py ${D}${datadir}/gdb/auto-load/${libdir}
Brad Bishop08902b02019-08-20 09:16:51 -040090 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
91 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
92 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
93 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
94 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050095 rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050096 rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
98 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
99 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
100 fi
101 if [ -d ${D}${infodir} ]; then
102 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
103 fi
Patrick Williams73bd93f2024-02-20 08:07:48 -0600104 if [ -d ${D}${libdir} ]; then
105 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}
106 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600107}
108
Patrick Williams213cb262021-08-07 19:21:33 -0500109do_install:append:class-target () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500110 if [ "${TARGET_OS}" = "linux-gnuspe" ]; then
111 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
112 fi
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600113
114 if [ "${TARGET_OS}" = "linux-gnun32" ]; then
Brad Bishopf3fd2882019-06-21 08:06:37 -0400115 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
116 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
117 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/32
118 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
119 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
120 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600121 else
122 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
123 fi
Brad Bishopf3fd2882019-06-21 08:06:37 -0400124 elif [ "${TARGET_OS}" = "linux-gnux32" ]; then
125 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
126 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
127 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/x32
128 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
129 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
130 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600131 else
132 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
133 fi
Brad Bishopf3fd2882019-06-21 08:06:37 -0400134 elif [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
Brad Bishopc8f47122019-06-24 09:36:18 -0400135 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}
Brad Bishopf3fd2882019-06-21 08:06:37 -0400136 ln -s ../${TARGET_SYS}/bits ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/bits
137 ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600138 fi
139
Andrew Geissler5082cc72023-09-11 08:41:39 -0400140 if [ "${TARGET_ARCH}" = "x86_64" -a "${MULTILIB_VARIANTS}" != "" ];then
Andrew Geissler635e0e42020-08-21 15:58:33 -0500141 ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32
142 fi
143
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600144 if [ "${TCLIBC}" != "glibc" ]; then
145 case "${TARGET_OS}" in
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500146 "linux-musl" | "linux-*spe") extra_target_os="linux";;
147 "linux-musleabi") extra_target_os="linux-gnueabi";;
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600148 *) extra_target_os="linux";;
149 esac
150 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
151 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500152 chown -R root:root ${D}
153}
154
155INHIBIT_DEFAULT_DEPS = "1"
Brad Bishop19323692019-04-05 15:28:33 -0400156DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500157PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
158
159BBCLASSEXTEND = "nativesdk"
160
161PACKAGES = "\
162 ${PN}-dbg \
163 libstdc++ \
164 libstdc++-precompile-dev \
165 libstdc++-dev \
166 libstdc++-staticdev \
167 libg2c \
168 libg2c-dev \
169 libssp \
170 libssp-dev \
171 libssp-staticdev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172 libquadmath \
173 libquadmath-dev \
174 libquadmath-staticdev \
175 libgomp \
176 libgomp-dev \
177 libgomp-staticdev \
178 libatomic \
179 libatomic-dev \
180 libatomic-staticdev \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500181 libitm \
182 libitm-dev \
183 libitm-staticdev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500184"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185# The base package doesn't exist, so we clear the recommends.
Patrick Williams213cb262021-08-07 19:21:33 -0500186RRECOMMENDS:${PN}-dbg = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500187
188# include python debugging scripts
Patrick Williams213cb262021-08-07 19:21:33 -0500189FILES:${PN}-dbg += "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190 ${datadir}/gcc-${BINV}/python/libstdcxx \
Patrick Williams73bd93f2024-02-20 08:07:48 -0600191 ${datadir}/gdb/auto-load \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500192"
Patrick Williams73bd93f2024-02-20 08:07:48 -0600193# Needed by libstdcxx pretty printer, however it is disabled intentionally
194# as it adds build time dependency on bash and some cases e.g. no GPL3 cases
195# bash is not availbale and builds fails
196# So it needs to be added manually to images sadly.
197# RDEPENDS:${PN}-dbg += "python3-datetime"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500198
Patrick Williams213cb262021-08-07 19:21:33 -0500199FILES:libg2c = "${target_libdir}/libg2c.so.*"
200SUMMARY:libg2c = "Companion runtime library for g77"
201FILES:libg2c-dev = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500202 ${libdir}/libg2c.so \
203 ${libdir}/libg2c.a \
204 ${libdir}/libfrtbegin.a \
205"
Patrick Williams213cb262021-08-07 19:21:33 -0500206SUMMARY:libg2c-dev = "Companion runtime library for g77 - development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500207
Patrick Williams213cb262021-08-07 19:21:33 -0500208FILES:libstdc++ = "${libdir}/libstdc++.so.*"
209SUMMARY:libstdc++ = "GNU standard C++ library"
210FILES:libstdc++-dev = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500211 ${includedir}/c++/ \
212 ${libdir}/libstdc++.so \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500213 ${libdir}/libstdc++*.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500214 ${libdir}/libsupc++.la \
215"
Patrick Williams213cb262021-08-07 19:21:33 -0500216SUMMARY:libstdc++-dev = "GNU standard C++ library - development files"
217FILES:libstdc++-staticdev = "\
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500218 ${libdir}/libstdc++*.a \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500219 ${libdir}/libsupc++.a \
220"
Patrick Williams213cb262021-08-07 19:21:33 -0500221SUMMARY:libstdc++-staticdev = "GNU standard C++ library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500222
Patrick Williams213cb262021-08-07 19:21:33 -0500223FILES:libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
224SUMMARY:libstdc++-precompile-dev = "GNU standard C++ library - precompiled header files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500225
Patrick Williams213cb262021-08-07 19:21:33 -0500226FILES:libssp = "${libdir}/libssp.so.*"
227SUMMARY:libssp = "GNU stack smashing protection library"
228FILES:libssp-dev = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500229 ${libdir}/libssp*.so \
230 ${libdir}/libssp*_nonshared.a \
231 ${libdir}/libssp*.la \
Brad Bishop08902b02019-08-20 09:16:51 -0400232 ${libdir}/${TARGET_SYS}/${BINV}/include/ssp \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233"
Patrick Williams213cb262021-08-07 19:21:33 -0500234SUMMARY:libssp-dev = "GNU stack smashing protection library - development files"
235FILES:libssp-staticdev = "${libdir}/libssp*.a"
236SUMMARY:libssp-staticdev = "GNU stack smashing protection library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500237
Patrick Williams213cb262021-08-07 19:21:33 -0500238FILES:libquadmath = "${libdir}/libquadmath*.so.*"
239SUMMARY:libquadmath = "GNU quad-precision math library"
240FILES:libquadmath-dev = "\
Brad Bishop08902b02019-08-20 09:16:51 -0400241 ${libdir}/${TARGET_SYS}/${BINV}/include/quadmath* \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500242 ${libdir}/libquadmath*.so \
243 ${libdir}/libquadmath.la \
244"
Patrick Williams213cb262021-08-07 19:21:33 -0500245SUMMARY:libquadmath-dev = "GNU quad-precision math library - development files"
246FILES:libquadmath-staticdev = "${libdir}/libquadmath.a"
247SUMMARY:libquadmath-staticdev = "GNU quad-precision math library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500248
Patrick Williams213cb262021-08-07 19:21:33 -0500249FILES:libgomp = "${libdir}/libgomp*${SOLIBS}"
250SUMMARY:libgomp = "GNU OpenMP parallel programming library"
251FILES:libgomp-dev = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500252 ${libdir}/libgomp*${SOLIBSDEV} \
253 ${libdir}/libgomp*.la \
254 ${libdir}/libgomp.spec \
Andrew Geisslerc182c622020-05-15 14:13:32 -0500255 ${libdir}/${TARGET_SYS}/${BINV}/include/acc_prof.h \
Brad Bishop08902b02019-08-20 09:16:51 -0400256 ${libdir}/${TARGET_SYS}/${BINV}/include/omp.h \
257 ${libdir}/${TARGET_SYS}/${BINV}/include/openacc.h \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500258"
Patrick Williams213cb262021-08-07 19:21:33 -0500259SUMMARY:libgomp-dev = "GNU OpenMP parallel programming library - development files"
260FILES:libgomp-staticdev = "${libdir}/libgomp*.a"
261SUMMARY:libgomp-staticdev = "GNU OpenMP parallel programming library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500262
Patrick Williams213cb262021-08-07 19:21:33 -0500263FILES:libatomic = "${libdir}/libatomic.so.*"
264SUMMARY:libatomic = "GNU C++11 atomics support library"
265FILES:libatomic-dev = "\
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500266 ${libdir}/libatomic.so \
267 ${libdir}/libatomic.la \
268"
Patrick Williams213cb262021-08-07 19:21:33 -0500269SUMMARY:libatomic-dev = "GNU C++11 atomics support library - development files"
270FILES:libatomic-staticdev = "${libdir}/libatomic.a"
271SUMMARY:libatomic-staticdev = "GNU C++11 atomics support library - static development files"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500272
Patrick Williams213cb262021-08-07 19:21:33 -0500273FILES:libitm = "${libdir}/libitm.so.*"
274SUMMARY:libitm = "GNU transactional memory support library"
275FILES:libitm-dev = "\
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500276 ${libdir}/libitm.so \
277 ${libdir}/libitm.la \
278 ${libdir}/libitm.spec \
279"
Patrick Williams213cb262021-08-07 19:21:33 -0500280SUMMARY:libitm-dev = "GNU transactional memory support library - development files"
281FILES:libitm-staticdev = "${libdir}/libitm.a"
282SUMMARY:libitm-staticdev = "GNU transactional memory support library - static development files"
Brad Bishop79641f22019-09-10 07:20:22 -0400283
284require gcc-testsuite.inc
285
Patrick Williams213cb262021-08-07 19:21:33 -0500286EXTRA_OEMAKE:prepend:task-check = "${PARALLEL_MAKE} "
Brad Bishop79641f22019-09-10 07:20:22 -0400287
288MAKE_CHECK_TARGETS ??= "check-gcc ${@" ".join("check-target-" + i for i in d.getVar("RUNTIMETARGET").split())}"
289# prettyprinters and xmethods require gdb tooling
290MAKE_CHECK_IGNORE ??= "prettyprinters.exp xmethods.exp"
291MAKE_CHECK_RUNTESTFLAGS ??= "${MAKE_CHECK_BOARDARGS} --ignore '${MAKE_CHECK_IGNORE}'"
292
293# specific host and target dependencies required for test suite running
294do_check[depends] += "dejagnu-native:do_populate_sysroot expect-native:do_populate_sysroot"
295do_check[depends] += "virtual/libc:do_populate_sysroot"
296# only depend on qemu if targeting linux user execution
297do_check[depends] += "${@'qemu-native:do_populate_sysroot' if "user" in d.getVar('TOOLCHAIN_TEST_TARGET') else ''}"
298# extend the recipe sysroot to include the built libraries (for qemu usermode)
299do_check[prefuncs] += "extend_recipe_sysroot"
300do_check[prefuncs] += "check_prepare"
301do_check[dirs] = "${WORKDIR}/dejagnu ${B}"
302do_check[nostamp] = "1"
303do_check() {
304 export DEJAGNU="${WORKDIR}/dejagnu/site.exp"
305
306 # HACK: this works around the configure setting CXX with -nostd* args
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000307 sed -i 's#-nostdinc++ -L${WORKDIR}/dummylib##g' $(find ${B} -name testsuite_flags | head -1)
Brad Bishop79641f22019-09-10 07:20:22 -0400308
309 if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then
310 # qemu user has issues allocating large amounts of memory
311 export G_SLICE=always-malloc
312 # no test should need more that 10G of memory, this prevents tests like pthread7-rope from leaking memory
313 ulimit -m 4194304
314 ulimit -v 10485760
315 fi
316
317 oe_runmake -i ${MAKE_CHECK_TARGETS} RUNTESTFLAGS="${MAKE_CHECK_RUNTESTFLAGS}"
318}
319addtask check after do_compile do_populate_sysroot
320