summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.1.bb
blob: 07a8e7c417717797807fec30e1aded3b2746a9bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
require binutils.inc
require binutils-${PV}.inc

BPN = "binutils"

DEPENDS += "dejagnu-native expect-native"
DEPENDS += "binutils-native"

deltask do_compile
deltask do_install

inherit nopackages

do_configure[dirs] += "${B}/ld ${B}/bfd"
do_configure() {
    # create config.h, oe enables initfini-array by default
    echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h
    # use the bfd_stdint.h from binutils-native, this is the same of the one
    # generated by binutils-cross
    cp ${RECIPE_SYSROOT_NATIVE}/usr/include/bfd_stdint.h ${B}/bfd/
}

# target depends
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}binutils"
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}gcc"
DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs"
DEPENDS += "virtual/${MLPREFIX}libc"

python check_prepare() {
    def suffix_sys(sys):
        if sys.endswith("-linux"):
            return sys + "-gnu"
        return sys

    def generate_site_exp(d, suite):
        content = []
        content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite))
        content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite))
        content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS")))
        content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS")))
        # use BUILD here since HOST=TARGET
        content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS")))
        content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS")))
        content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS")))
        content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS"))))
        content.append("set development true")
        content.append("set experimental false")

        content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"'))
        content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
        content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))
        content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"'))

        if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64":
            # oe patches binutils to have the default mips64 abi as 64bit, but
            # skips gas causing issues with the ld test suite (which uses gas)
            content.append('set ASFLAGS "-64"')

        return "\n".join(content)

    for i in ["binutils", "gas", "ld"]:
        builddir = os.path.join(d.getVar("B"), i)
        if not os.path.isdir(builddir):
            os.makedirs(builddir)
        with open(os.path.join(builddir, "site.exp"), "w") as f:
            f.write(generate_site_exp(d, i))
}

CHECK_TARGETS ??= "binutils gas ld"

do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld"
do_check[prefuncs] += "check_prepare"
do_check[nostamp] = "1"
do_check() {
    export LC_ALL=C
    for i in ${CHECK_TARGETS}; do
        (cd ${B}/$i; runtest \
            --tool $i \
            --srcdir ${S}/$i/testsuite \
            --ignore 'plugin.exp' \
            || true)
    done
}
addtask check after do_configure