diff --git a/prelude/cxx/dist_lto/dist_lto.bzl b/prelude/cxx/dist_lto/dist_lto.bzl index b8bc0a1e2346..35b93957363c 100644 --- a/prelude/cxx/dist_lto/dist_lto.bzl +++ b/prelude/cxx/dist_lto/dist_lto.bzl @@ -513,7 +513,7 @@ def cxx_dist_link( def dynamic_optimize_archive(archive: ArchiveLinkData.type): def optimize_archive(ctx, artifacts, outputs): plan_json = artifacts[archive.plan].read_json() - if "objects" not in plan_json or not plan_json["objects"]: + if "objects" not in plan_json or not plan_json["objects"] or all([not entry["is_bc"] for entry in plan_json["objects"]]): # Nothing in this directory was lto-able; let's just copy the archive. ctx.actions.copy_file(outputs[archive.opt_objects_dir], archive.objects_dir) ctx.actions.write(outputs[archive.opt_manifest], "")