summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/recipes-devtools/binutils/binutils.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-core/recipes-devtools/binutils/binutils.inc')
-rw-r--r--meta-xilinx-core/recipes-devtools/binutils/binutils.inc207
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 @@
1SUMMARY = "GNU binary utilities"
2DESCRIPTION = "The GNU Binutils are a collection of binary tools. \
3The main ones are ld (GNU Linker), and as (GNU Assembler). This \
4package also includes addition tools such as addr2line (Converts \
5addresses into filenames and line numbers), ar (utility for creating, \
6modifying and extracting archives), nm (list symbols in object \
7files), objcopy (copy and translate object files), objdump (Display \
8object information), and other tools and related libraries."
9HOMEPAGE = "http://www.gnu.org/software/binutils/"
10BUGTRACKER = "http://sourceware.org/bugzilla/"
11SECTION = "devel"
12LICENSE = "GPL-3.0-only"
13
14DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native"
15
16inherit autotools gettext multilib_header pkgconfig texinfo
17
18FILES:${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
26RPROVIDES:${PN} += "${PN}-symlinks"
27
28FILES:${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
36FILES:${PN}-staticdev += "${libdir}/gprofng/*.a"
37
38# Rather than duplicating multiple entries for these, make one
39# list and reuse it.
40
41GPROFNGS = " \
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
51GPROFNGS:toolchain-clang = ""
52GPROFNGS:libc-musl = ""
53
54GPROFNG_ALTS ?= ""
55GPROFNG_ALTS:x86 = "${GPROFNGS}"
56GPROFNG_ALTS:x86-64 = "${GPROFNGS}"
57GPROFNG_ALTS:aarch64 = "${GPROFNGS}"
58
59LDGOLD_ALTS ?= "ld.gold dwp"
60LDGOLD_ALTS:riscv64 = ""
61LDGOLD_ALTS:riscv32 = ""
62LDGOLD_ALTS:loongarch64 = ""
63LDGOLD_ALTS:libc-glibc:mipsarch = ""
64
65USE_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
86python 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
95B = "${S}/build.${HOST_SYS}.${TARGET_SYS}"
96
97EXTRA_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
111EXTRA_TARGETS = ""
112EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep "
113EXTRA_TARGETS:class-native = ""
114
115LDGOLD:class-native = ""
116LDGOLD:class-crosssdk = ""
117LDGOLD:libc-glibc:mipsarch = ""
118LDGOLD ?= "${@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
124export AR = "${HOST_PREFIX}ar"
125export AS = "${HOST_PREFIX}as"
126export LD = "${HOST_PREFIX}ld"
127export NM = "${HOST_PREFIX}nm"
128export RANLIB = "${HOST_PREFIX}ranlib"
129export OBJCOPY = "${HOST_PREFIX}objcopy"
130export OBJDUMP = "${HOST_PREFIX}objdump"
131
132export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
133export AS_FOR_TARGET = "${TARGET_PREFIX}as"
134export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
135export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
136export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
137
138export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}"
139export 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.
143export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}"
144
145MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}"
146do_configure[vardeps] += "MULTIARCH"
147do_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
160do_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
198inherit update-alternatives
199
200ALTERNATIVE_PRIORITY = "100"
201
202ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}"
203
204python () {
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}