binutils.inc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. SUMMARY = "GNU binary utilities"
  2. DESCRIPTION = "The GNU Binutils are a collection of binary tools. \
  3. The main ones are ld (GNU Linker), and as (GNU Assembler). This \
  4. package also includes addition tools such as addr2line (Converts \
  5. addresses into filenames and line numbers), ar (utility for creating, \
  6. modifying and extracting archives), nm (list symbols in object \
  7. files), objcopy (copy and translate object files), objdump (Display \
  8. object information), and other tools and related libraries."
  9. HOMEPAGE = "http://www.gnu.org/software/binutils/"
  10. BUGTRACKER = "http://sourceware.org/bugzilla/"
  11. SECTION = "devel"
  12. LICENSE = "GPLv3"
  13. DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native"
  14. inherit autotools gettext multilib_header pkgconfig texinfo
  15. FILES:${PN} = " \
  16. ${bindir}/${TARGET_PREFIX}* \
  17. ${libdir}/lib*.so.* \
  18. ${libdir}/bfd-plugins/lib*.so \
  19. ${libdir}/lib*-${PV}*.so \
  20. ${prefix}/${TARGET_SYS}/bin/* \
  21. ${bindir}/embedspu"
  22. RPROVIDES:${PN} += "${PN}-symlinks"
  23. FILES:${PN}-dev = " \
  24. ${includedir} \
  25. ${libdir}/*.la \
  26. ${libdir}/libbfd.so \
  27. ${libdir}/libctf.so \
  28. ${libdir}/libctf-nobfd.so \
  29. ${libdir}/libopcodes.so"
  30. # Rather than duplicating multiple entries for these, make one
  31. # list and reuse it.
  32. LDGOLD_ALTS ?= "ld.gold dwp"
  33. LDGOLD_ALTS:riscv64 = ""
  34. LDGOLD_ALTS:riscv32 = ""
  35. LDGOLD_ALTS:libc-glibc:mipsarch = ""
  36. USE_ALTERNATIVES_FOR = " \
  37. addr2line \
  38. ar \
  39. as \
  40. c++filt \
  41. elfedit \
  42. gprof \
  43. ld \
  44. ld.bfd \
  45. ${LDGOLD_ALTS} \
  46. nm \
  47. objcopy \
  48. objdump \
  49. ranlib \
  50. readelf \
  51. size \
  52. strings \
  53. strip \
  54. "
  55. python do_package:prepend() {
  56. make_alts = d.getVar("USE_ALTERNATIVES_FOR") or ""
  57. prefix = d.getVar("TARGET_PREFIX")
  58. bindir = d.getVar("bindir")
  59. for alt in make_alts.split():
  60. d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt)
  61. d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt)
  62. }
  63. B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
  64. EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \
  65. --disable-werror \
  66. --enable-deterministic-archives \
  67. --enable-plugins \
  68. --disable-gdb \
  69. --disable-gdbserver \
  70. --disable-libdecnumber \
  71. --disable-readline \
  72. --disable-sim \
  73. ${LDGOLD} \
  74. ${EXTRA_TARGETS} \
  75. ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}"
  76. EXTRA_TARGETS = ""
  77. EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep "
  78. EXTRA_TARGETS:class-native = ""
  79. LDGOLD:class-native = ""
  80. LDGOLD:class-crosssdk = ""
  81. LDGOLD:libc-glibc:mipsarch = ""
  82. LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}"
  83. # This is necessary due to a bug in the binutils Makefiles
  84. # EXTRA_OEMAKE = "configure-build-libiberty all"
  85. export AR = "${HOST_PREFIX}ar"
  86. export AS = "${HOST_PREFIX}as"
  87. export LD = "${HOST_PREFIX}ld"
  88. export NM = "${HOST_PREFIX}nm"
  89. export RANLIB = "${HOST_PREFIX}ranlib"
  90. export OBJCOPY = "${HOST_PREFIX}objcopy"
  91. export OBJDUMP = "${HOST_PREFIX}objdump"
  92. export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
  93. export AS_FOR_TARGET = "${TARGET_PREFIX}as"
  94. export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
  95. export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
  96. export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
  97. export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
  98. export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
  99. # autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need
  100. # to unset LD_LIBRARY_PATH.
  101. export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
  102. MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
  103. do_configure[vardeps] += "MULTIARCH"
  104. do_configure () {
  105. (cd ${S} && gnu-configize)
  106. oe_runconf
  107. #
  108. # must prime config.cache to ensure the build of libiberty
  109. #
  110. mkdir -p ${B}/build-${BUILD_SYS}
  111. for i in ${CONFIG_SITE}; do
  112. cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true
  113. done
  114. }
  115. do_install () {
  116. autotools_do_install
  117. # We don't really need these, so we'll remove them...
  118. rm -rf ${D}${libdir}/ldscripts
  119. bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')}
  120. # Fix the /usr/${TARGET_SYS}/bin/* links
  121. for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do
  122. rm -f $l
  123. ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l
  124. done
  125. # Install the libiberty header
  126. install -d ${D}${includedir}
  127. install -m 644 ${S}/include/ansidecl.h ${D}${includedir}
  128. install -m 644 ${S}/include/libiberty.h ${D}${includedir}
  129. # insall pic version of libiberty if available
  130. if [ -e ${B}/libiberty/pic/libiberty.a ]; then
  131. install -Dm 0644 ${B}/libiberty/pic/libiberty.a ${D}${libdir}/libiberty.a
  132. fi
  133. cd ${D}${bindir}
  134. # Symlinks for ease of running these on the native target
  135. for p in ${TARGET_PREFIX}* ; do
  136. ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,`
  137. done
  138. for alt in ${USE_ALTERNATIVES_FOR}; do
  139. rm -f ${D}${bindir}/$alt
  140. done
  141. oe_multilib_header bfd.h
  142. }
  143. inherit update-alternatives
  144. ALTERNATIVE_PRIORITY = "100"
  145. ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}"
  146. python () {
  147. if bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', True, False, d) and bb.utils.contains_any('TARGET_ARCH', 'riscv32 riscv64', True, False, d):
  148. bb.fatal("Gold linker does not _yet_ support RISC-V architecture please remove ld-is-gold from DISTRO_FEATURES")
  149. }