libgcc-initial.inc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. # a) specify the minimum glibc version to support in a configure option
  11. # b) create a dummy limits.h file so that later when glibc creates one,
  12. # the headers structure has support for it. We can do this with a simple
  13. # empty file
  14. #
  15. # Once gcc-cross is libc independent, we can use it to build both
  16. # libgcc-initial and then later libgcc.
  17. #
  18. # libgcc-initial is tricky as we need to imitate the non-threaded and
  19. # non-shared case. We can do that by hacking the threading mode back to
  20. # "single" even if gcc reports "posix" and disable libc presence for the
  21. # libgcc-intial build. We have to create the dummy limits.h to avoid
  22. # compiler errors from a missing header.
  23. #
  24. # glibc will fail to link with libgcc-initial due to a missing "exception
  25. # handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need
  26. # any exception handler, we can safely symlink to libgcc.a.
  27. #
  28. require libgcc-common.inc
  29. DEPENDS = "virtual/${TARGET_PREFIX}gcc"
  30. LICENSE = "GPL-3.0-with-GCC-exception"
  31. PACKAGES = ""
  32. EXTRA_OECONF += "--disable-shared"
  33. inherit nopackages
  34. # We really only want this built by things that need it, not any recrdeptask
  35. deltask do_build
  36. do_configure:prepend () {
  37. install -d ${STAGING_INCDIR}
  38. touch ${STAGING_INCDIR}/limits.h
  39. sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
  40. sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
  41. }
  42. do_configure:append () {
  43. sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile
  44. }
  45. do_install:append () {
  46. ln -s libgcc.a ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc_eh.a
  47. }