glibc.inc 3.3 KB

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