blob: 14480785b4db7d8dad3bc45ceebfb3e1e5e67ee8 [file] [log] [blame]
Brad Bishop79641f22019-09-10 07:20:22 -04001require binutils.inc
2require binutils-${PV}.inc
3
4BPN = "binutils"
5
6DEPENDS += "dejagnu-native expect-native"
7DEPENDS += "binutils-native"
8
9deltask do_compile
10deltask do_install
11
12inherit nopackages
13
14do_configure[dirs] += "${B}/ld ${B}/bfd"
15do_configure() {
16 # create config.h, oe enables initfini-array by default
17 echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h
Brad Bishop79641f22019-09-10 07:20:22 -040018}
19
20# target depends
Andrew Geissler028142b2023-05-05 11:29:21 -050021DEPENDS += "virtual/${TARGET_PREFIX}binutils"
22DEPENDS += "virtual/${TARGET_PREFIX}gcc"
Brad Bishop79641f22019-09-10 07:20:22 -040023DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
24DEPENDS += "virtual/${MLPREFIX}libc"
25
26python check_prepare() {
27 def suffix_sys(sys):
28 if sys.endswith("-linux"):
29 return sys + "-gnu"
30 return sys
31
32 def generate_site_exp(d, suite):
33 content = []
34 content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite))
35 content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite))
36 content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS")))
37 content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS")))
38 # use BUILD here since HOST=TARGET
39 content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS")))
40 content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS")))
41 content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS")))
42 content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS"))))
43 content.append("set development true")
44 content.append("set experimental false")
45
46 content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
47 content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
48 content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
49 content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
50
51 if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64":
52 # oe patches binutils to have the default mips64 abi as 64bit, but
53 # skips gas causing issues with the ld test suite (which uses gas)
54 content.append('set ASFLAGS "-64"')
55
56 return "\n".join(content)
57
58 for i in ["binutils", "gas", "ld"]:
59 builddir = os.path.join(d.getVar("B"), i)
60 if not os.path.isdir(builddir):
61 os.makedirs(builddir)
62 with open(os.path.join(builddir, "site.exp"), "w") as f:
63 f.write(generate_site_exp(d, i))
64}
65
66CHECK_TARGETS ??= "binutils gas ld"
67
68do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
69do_check[prefuncs] += "check_prepare"
70do_check[nostamp] = "1"
71do_check() {
72 export LC_ALL=C
73 for i in ${CHECK_TARGETS}; do
74 (cd ${B}/$i; runtest \
75 --tool $i \
76 --srcdir ${S}/$i/testsuite \
77 --ignore 'plugin.exp' \
78 || true)
79 done
80}
81addtask check after do_configure