Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 1 | require binutils.inc |
| 2 | require binutils-${PV}.inc |
| 3 | |
| 4 | BPN = "binutils" |
| 5 | |
| 6 | DEPENDS += "dejagnu-native expect-native" |
| 7 | DEPENDS += "binutils-native" |
| 8 | |
| 9 | deltask do_compile |
| 10 | deltask do_install |
| 11 | |
| 12 | inherit nopackages |
| 13 | |
| 14 | do_configure[dirs] += "${B}/ld ${B}/bfd" |
| 15 | do_configure() { |
| 16 | # create config.h, oe enables initfini-array by default |
| 17 | echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | # target depends |
Andrew Geissler | 028142b | 2023-05-05 11:29:21 -0500 | [diff] [blame] | 21 | DEPENDS += "virtual/${TARGET_PREFIX}binutils" |
| 22 | DEPENDS += "virtual/${TARGET_PREFIX}gcc" |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 23 | DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs" |
| 24 | DEPENDS += "virtual/${MLPREFIX}libc" |
| 25 | |
| 26 | python 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 | |
| 66 | CHECK_TARGETS ??= "binutils gas ld" |
| 67 | |
| 68 | do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld" |
| 69 | do_check[prefuncs] += "check_prepare" |
| 70 | do_check[nostamp] = "1" |
| 71 | do_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 | } |
| 81 | addtask check after do_configure |