blob: 99c92ce46e4e0c7f84c2bbe20eaf905f3e0c04ea [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001require glibc-common.inc
2require glibc-ld.inc
3require glibc-testing.inc
4
5STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
Patrick Williamsc0f7c042017-02-23 20:41:17 -06006STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
8
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05009python () {
10 opt_effective = "-O"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011 for opt in d.getVar('SELECTED_OPTIMIZATION').split():
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050012 if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
13 opt_effective = opt
14 if opt_effective == "-O0":
Brad Bishop6e60e8b2018-02-01 10:27:11 -050015 bb.fatal("%s can't be built with %s, try -O1 instead" % (d.getVar('PN'), opt_effective))
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050016}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050017
18# siteconfig.bbclass runs configure which needs a working compiler
19# For the compiler to work we need a working libc yet libc isn't
20# in the sysroots directory at this point. This means the libc.so
21# linker script won't work as the --sysroot setting isn't correct.
22# Here we create a hacked up libc linker script and pass in the right
23# flags to let configure work. Ugly.
24EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
25siteconfig_do_siteconfig_gencache_prepend = " \
26 mkdir -p ${WORKDIR}/site_config_libc; \
27 cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
28 sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
29"
30
31# nptl needs unwind support in gcc, which can't be built without glibc.
32DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial"
Brad Bishop316dfdd2018-06-25 12:45:53 -040033
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035PROVIDES += "virtual/libintl virtual/libiconv"
36inherit autotools texinfo distro_features_check systemd
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037
38LEAD_SONAME = "libc.so"
39
40CACHED_CONFIGUREVARS += " \
41 ac_cv_path_BASH_SHELL=${base_bindir}/bash \
42 libc_cv_slibdir=${base_libdir} \
43 libc_cv_rootsbindir=${base_sbindir} \
44 libc_cv_localedir=${localedir} \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050045 libc_cv_ssp_strong=no \
Brad Bishop316dfdd2018-06-25 12:45:53 -040046 libc_cv_ssp_all=no \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 libc_cv_ssp=no \
48"
49
50GLIBC_EXTRA_OECONF ?= ""
51GLIBC_EXTRA_OECONF_class-nativesdk = ""
52INHIBIT_DEFAULT_DEPS = "1"
53
54# This needs to match with glibc-collateral.inc, otherwise glibc-scripts and glibc-locale
55# will fail to find main glibc, for details see
56# http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100679.html
Brad Bishop316dfdd2018-06-25 12:45:53 -040057ARM_INSTRUCTION_SET_armv4 = "arm"
58ARM_INSTRUCTION_SET_armv5 = "arm"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080059ARM_INSTRUCTION_SET_armv6 = "arm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050060
61# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
62# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
63EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}""
64EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM"
65EXTRA_OEMAKE += "${EGLIBCPARALLELISM}"
66PARALLEL_MAKE = ""
67
68# glibc make-syscalls.sh has a number of issues with /bin/dash and
69# it's output which make calls via the SHELL also has issues, so
70# ensure make uses /bin/bash
71EXTRA_OEMAKE += "SHELL=/bin/bash"
72
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073do_configure_prepend() {
74 sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075}
76
Brad Bishop37a0e4d2017-12-04 01:01:44 -050077# Enable backtrace from abort()
78do_configure_append_arm () {
79 echo "CFLAGS-abort.c = -fasynchronous-unwind-tables" >> ${B}/configparms
80 echo "CFLAGS-raise.c = -fasynchronous-unwind-tables" >> ${B}/configparms
81}