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}"')) |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 50 | content.append(d.expand('set LD "${TARGET_PREFIX}ld ${TUNE_LDARGS}"')) |
| 51 | content.append(d.expand('set LDFLAGS_FOR_TARGET "${TUNE_LDARGS}"')) |
Brad Bishop | 79641f2 | 2019-09-10 07:20:22 -0400 | [diff] [blame] | 52 | |
| 53 | if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64": |
| 54 | # oe patches binutils to have the default mips64 abi as 64bit, but |
| 55 | # skips gas causing issues with the ld test suite (which uses gas) |
| 56 | content.append('set ASFLAGS "-64"') |
| 57 | |
| 58 | return "\n".join(content) |
| 59 | |
| 60 | for i in ["binutils", "gas", "ld"]: |
| 61 | builddir = os.path.join(d.getVar("B"), i) |
| 62 | if not os.path.isdir(builddir): |
| 63 | os.makedirs(builddir) |
| 64 | with open(os.path.join(builddir, "site.exp"), "w") as f: |
| 65 | f.write(generate_site_exp(d, i)) |
| 66 | } |
| 67 | |
| 68 | CHECK_TARGETS ??= "binutils gas ld" |
| 69 | |
| 70 | do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld" |
| 71 | do_check[prefuncs] += "check_prepare" |
| 72 | do_check[nostamp] = "1" |
| 73 | do_check() { |
| 74 | export LC_ALL=C |
| 75 | for i in ${CHECK_TARGETS}; do |
| 76 | (cd ${B}/$i; runtest \ |
| 77 | --tool $i \ |
| 78 | --srcdir ${S}/$i/testsuite \ |
| 79 | --ignore 'plugin.exp' \ |
| 80 | || true) |
| 81 | done |
| 82 | } |
| 83 | addtask check after do_configure |