diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 38e79e874e1..e1fa14e66e9 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -729,12 +729,12 @@ jobs: setup_script_args="" if [[ ${{ matrix.os}} == "bare_metal" ]]; then toolchain_prefix=arm-none-eabi- - threshold="34000" # GCC 15.2, minimal PAL + nano baseline: 33372 bytes, 2026-10-27 + threshold="35000" # GCC 15.2, minimal PAL + nano baseline: 32180 bytes, 2026-10-28 toolchain_cmake=examples/arm/ethos-u-setup/arm-none-eabi-gcc.cmake elif [[ ${{ matrix.os}} == "zephyr-preset" ]]; then setup_script_args="--target-toolchain zephyr" toolchain_prefix=arm-zephyr-eabi- - threshold="57000" # Zephyr SDK 1.0.1, minimal PAL baseline: 55800 bytes, 2026-10-27 + threshold="50000" # Zephyr SDK 1.0.1, minimal PAL baseline: 46112 bytes, 2026-10-28 toolchain_cmake=examples/zephyr/x86_64-linux-arm-zephyr-eabi-gcc.cmake else echo "Unsupported OS selection: ${{ matrix.os }}" diff --git a/runtime/executor/method.cpp b/runtime/executor/method.cpp index 9b8b9e34008..fc46fc29814 100644 --- a/runtime/executor/method.cpp +++ b/runtime/executor/method.cpp @@ -13,7 +13,7 @@ #include #include // @donotremove #include -#include +#include #include #include @@ -769,26 +769,29 @@ Error populate_operator_name( ET_CHECK_OR_RETURN_ERROR( op->name() != nullptr, InvalidProgram, "Missing operator name"); - int cx = snprintf( - operator_name, - operator_name_size, - "%s%s%s", - op->name()->c_str(), - // Don't append any overload if the overload string is empty. - has_overload ? "." : "", - has_overload ? op->overload()->c_str() : ""); - ET_CHECK_OR_RETURN_ERROR(cx >= 0, Internal, "snprintf failed: %d", cx); + // Avoid pulling printf formatting code into builds that otherwise omit it. + const size_t name_size = strlen(op->name()->c_str()); + const size_t overload_size = + has_overload ? strlen(op->overload()->c_str()) : 0; + const uint64_t needed_size = static_cast(name_size) + + overload_size + (has_overload ? 1 : 0) + 1; ET_CHECK_OR_RETURN_ERROR( - static_cast(cx) < operator_name_size, + needed_size <= operator_name_size, Internal, - "Operator name %s%s%s with length %d " - "truncated to %" ET_PRIsize_t " due to internal buffer limit.", + "Operator name %s%s%s exceeds internal buffer limit of %" ET_PRIsize_t, op->name()->c_str(), has_overload ? "." : "", has_overload ? op->overload()->c_str() : "", - cx, operator_name_size); + memcpy(operator_name, op->name()->c_str(), name_size); + size_t pos = name_size; + if (has_overload) { + operator_name[pos++] = '.'; + memcpy(operator_name + pos, op->overload()->c_str(), overload_size); + pos += overload_size; + } + operator_name[pos] = '\0'; return Error::Ok; } } // namespace