# --- T2-COPYRIGHT-BEGIN --- # t2/package/*/yosys/hotfix-tcl9.patch # Copyright (C) 2026 The T2 SDE Project # SPDX-License-Identifier: GPL-2.0 or patched project license # --- T2-COPYRIGHT-END --- --- yosys-0.67/kernel/tclapi.cc +++ yosys-0.67/kernel/tclapi.cc @@ -213,9 +213,16 @@ bool mp_int_to_const(mp_int *a, Const &b } std::vector buf; +#if defined(mp_ubin_size) && defined(mp_to_ubin) + // Tcl 8.7 and newer only export the non-deprecated libtommath API + buf.resize(mp_ubin_size(a)); + if (mp_to_ubin(a, buf.data(), buf.size(), nullptr) != MP_OKAY) + return false; +#else buf.resize(mp_unsigned_bin_size(a)); if (mp_to_unsigned_bin(a, buf.data()) != MP_OKAY) return false; +#endif Const::Builder b_bits(mp_count_bits(a) + is_signed); for (int i = 0; i < mp_count_bits(a);) {