diff options
Diffstat (limited to 'meta-xilinx-core/recipes-devtools/binutils/binutils.inc')
| -rw-r--r-- | meta-xilinx-core/recipes-devtools/binutils/binutils.inc | 207 |
1 files changed, 207 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-devtools/binutils/binutils.inc b/meta-xilinx-core/recipes-devtools/binutils/binutils.inc new file mode 100644 index 00000000..e1b903f1 --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/binutils/binutils.inc | |||
| @@ -0,0 +1,207 @@ | |||
| 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 = "GPL-3.0-only" | ||
| 13 | |||
| 14 | DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native" | ||
| 15 | |||
| 16 | inherit autotools gettext multilib_header pkgconfig texinfo | ||
| 17 | |||
| 18 | FILES:${PN} = " \ | ||
| 19 | ${bindir}/${TARGET_PREFIX}* \ | ||
| 20 | ${libdir}/lib*.so.* \ | ||
| 21 | ${libdir}/bfd-plugins/lib*${SOLIBSDEV} \ | ||
| 22 | ${libdir}/lib*-${PV}*.so \ | ||
| 23 | ${prefix}/${TARGET_SYS}/bin/* \ | ||
| 24 | ${bindir}/embedspu" | ||
| 25 | |||
| 26 | RPROVIDES:${PN} += "${PN}-symlinks" | ||
| 27 | |||
| 28 | FILES:${PN}-dev = " \ | ||
| 29 | ${includedir} \ | ||
| 30 | ${libdir}/*.la \ | ||
| 31 | ${libdir}/libbfd.so \ | ||
| 32 | ${libdir}/libctf.so \ | ||
| 33 | ${libdir}/libctf-nobfd.so \ | ||
| 34 | ${libdir}/libopcodes.so" | ||
| 35 | |||
| 36 | FILES:${PN}-staticdev += "${libdir}/gprofng/*.a" | ||
| 37 | |||
| 38 | # Rather than duplicating multiple entries for these, make one | ||
| 39 | # list and reuse it. | ||
| 40 | |||
| 41 | GPROFNGS = " \ | ||
| 42 | gp-archive \ | ||
| 43 | gp-collect-app \ | ||
| 44 | gp-display-html \ | ||
| 45 | gp-display-src \ | ||
| 46 | gp-display-text \ | ||
| 47 | gprofng \ | ||
| 48 | " | ||
| 49 | |||
| 50 | # it disables gprofng for clang and musl in the bb file | ||
| 51 | GPROFNGS:toolchain-clang = "" | ||
| 52 | GPROFNGS:libc-musl = "" | ||
| 53 | |||
| 54 | GPROFNG_ALTS ?= "" | ||
| 55 | GPROFNG_ALTS:x86 = "${GPROFNGS}" | ||
| 56 | GPROFNG_ALTS:x86-64 = "${GPROFNGS}" | ||
| 57 | GPROFNG_ALTS:aarch64 = "${GPROFNGS}" | ||
| 58 | |||
| 59 | LDGOLD_ALTS ?= "ld.gold dwp" | ||
| 60 | LDGOLD_ALTS:riscv64 = "" | ||
| 61 | LDGOLD_ALTS:riscv32 = "" | ||
| 62 | LDGOLD_ALTS:loongarch64 = "" | ||
| 63 | LDGOLD_ALTS:libc-glibc:mipsarch = "" | ||
| 64 | |||
| 65 | USE_ALTERNATIVES_FOR = " \ | ||
| 66 | addr2line \ | ||
| 67 | ar \ | ||
| 68 | as \ | ||
| 69 | c++filt \ | ||
| 70 | elfedit \ | ||
| 71 | gprof \ | ||
| 72 | ${GPROFNG_ALTS} \ | ||
| 73 | ld \ | ||
| 74 | ld.bfd \ | ||
| 75 | ${LDGOLD_ALTS} \ | ||
| 76 | nm \ | ||
| 77 | objcopy \ | ||
| 78 | objdump \ | ||
| 79 | ranlib \ | ||
| 80 | readelf \ | ||
| 81 | size \ | ||
| 82 | strings \ | ||
| 83 | strip \ | ||
| 84 | " | ||
| 85 | |||
| 86 | python do_package:prepend() { | ||
| 87 | make_alts = d.getVar("USE_ALTERNATIVES_FOR") or "" | ||
| 88 | prefix = d.getVar("TARGET_PREFIX") | ||
| 89 | bindir = d.getVar("bindir") | ||
| 90 | for alt in make_alts.split(): | ||
| 91 | d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt) | ||
| 92 | d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt) | ||
| 93 | } | ||
| 94 | |||
| 95 | B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" | ||
| 96 | |||
| 97 | EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \ | ||
| 98 | --disable-werror \ | ||
| 99 | --enable-deterministic-archives \ | ||
| 100 | --enable-plugins \ | ||
| 101 | --enable-new-dtags \ | ||
| 102 | --disable-gdb \ | ||
| 103 | --disable-gdbserver \ | ||
| 104 | --disable-libdecnumber \ | ||
| 105 | --disable-readline \ | ||
| 106 | --disable-sim \ | ||
| 107 | ${LDGOLD} \ | ||
| 108 | ${EXTRA_TARGETS} \ | ||
| 109 | ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}" | ||
| 110 | |||
| 111 | EXTRA_TARGETS = "" | ||
| 112 | EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep " | ||
| 113 | EXTRA_TARGETS:class-native = "" | ||
| 114 | |||
| 115 | LDGOLD:class-native = "" | ||
| 116 | LDGOLD:class-crosssdk = "" | ||
| 117 | LDGOLD:libc-glibc:mipsarch = "" | ||
| 118 | LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}" | ||
| 119 | |||
| 120 | |||
| 121 | # This is necessary due to a bug in the binutils Makefiles | ||
| 122 | # EXTRA_OEMAKE = "configure-build-libiberty all" | ||
| 123 | |||
| 124 | export AR = "${HOST_PREFIX}ar" | ||
| 125 | export AS = "${HOST_PREFIX}as" | ||
| 126 | export LD = "${HOST_PREFIX}ld" | ||
| 127 | export NM = "${HOST_PREFIX}nm" | ||
| 128 | export RANLIB = "${HOST_PREFIX}ranlib" | ||
| 129 | export OBJCOPY = "${HOST_PREFIX}objcopy" | ||
| 130 | export OBJDUMP = "${HOST_PREFIX}objdump" | ||
| 131 | |||
| 132 | export AR_FOR_TARGET = "${TARGET_PREFIX}ar" | ||
| 133 | export AS_FOR_TARGET = "${TARGET_PREFIX}as" | ||
| 134 | export LD_FOR_TARGET = "${TARGET_PREFIX}ld" | ||
| 135 | export NM_FOR_TARGET = "${TARGET_PREFIX}nm" | ||
| 136 | export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib" | ||
| 137 | |||
| 138 | export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" | ||
| 139 | export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" | ||
| 140 | |||
| 141 | # autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need | ||
| 142 | # to unset LD_LIBRARY_PATH. | ||
| 143 | export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}" | ||
| 144 | |||
| 145 | MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}" | ||
| 146 | do_configure[vardeps] += "MULTIARCH" | ||
| 147 | do_configure () { | ||
| 148 | (cd ${S} && gnu-configize) | ||
| 149 | |||
| 150 | oe_runconf | ||
| 151 | # | ||
| 152 | # must prime config.cache to ensure the build of libiberty | ||
| 153 | # | ||
| 154 | mkdir -p ${B}/build-${BUILD_SYS} | ||
| 155 | for i in ${CONFIG_SITE}; do | ||
| 156 | cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true | ||
| 157 | done | ||
| 158 | } | ||
| 159 | |||
| 160 | do_install () { | ||
| 161 | autotools_do_install | ||
| 162 | |||
| 163 | # We don't really need these, so we'll remove them... | ||
| 164 | rm -rf ${D}${libdir}/ldscripts | ||
| 165 | |||
| 166 | bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')} | ||
| 167 | |||
| 168 | # Fix the /usr/${TARGET_SYS}/bin/* links | ||
| 169 | for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do | ||
| 170 | rm -f $l | ||
| 171 | ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l | ||
| 172 | done | ||
| 173 | |||
| 174 | # Install the libiberty header | ||
| 175 | install -d ${D}${includedir} | ||
| 176 | install -m 644 ${S}/include/ansidecl.h ${D}${includedir} | ||
| 177 | install -m 644 ${S}/include/libiberty.h ${D}${includedir} | ||
| 178 | |||
| 179 | # insall pic version of libiberty if available | ||
| 180 | if [ -e ${B}/libiberty/pic/libiberty.a ]; then | ||
| 181 | install -Dm 0644 ${B}/libiberty/pic/libiberty.a ${D}${libdir}/libiberty.a | ||
| 182 | fi | ||
| 183 | |||
| 184 | cd ${D}${bindir} | ||
| 185 | |||
| 186 | # Symlinks for ease of running these on the native target | ||
| 187 | for p in ${TARGET_PREFIX}* ; do | ||
| 188 | ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,` | ||
| 189 | done | ||
| 190 | |||
| 191 | for alt in ${USE_ALTERNATIVES_FOR}; do | ||
| 192 | rm -f ${D}${bindir}/$alt | ||
| 193 | done | ||
| 194 | |||
| 195 | oe_multilib_header bfd.h | ||
| 196 | } | ||
| 197 | |||
| 198 | inherit update-alternatives | ||
| 199 | |||
| 200 | ALTERNATIVE_PRIORITY = "100" | ||
| 201 | |||
| 202 | ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}" | ||
| 203 | |||
| 204 | python () { | ||
| 205 | if bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', True, False, d) and bb.utils.contains_any('TARGET_ARCH', 'riscv32 riscv64 loongarch64', True, False, d): | ||
| 206 | bb.fatal("Gold linker does not _yet_ support RISC-V and LoongArch architecture please remove ld-is-gold from DISTRO_FEATURES") | ||
| 207 | } | ||
