From 837bda3fc0a371dd909a6e6629bc781d53e01713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 6 Jul 2026 12:28:51 +0200 Subject: [PATCH 1/3] bazel: bump bazel-orfs for single-writer 1_synth.sdc (fixes RBE) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1_synth.sdc had two writers in ORFS: yosys' synth.tcl copied the user's SDC_FILE into place, then synth_odb.tcl overwrote it in place with the OpenSTA-canonicalized version. cp preserves mode bits, so with read-only inputs (RBE) the copy is read-only and the write fails; locally it only accidentally worked. Supersedes #10818's chmod +w workaround. - Bump BAZEL_ORFS_COMMIT to bazel-orfs#754, which fixes this and also stops touch-stubbing missing primary synth artifacts, so a silently-missing output fails the action instead of flowing downstream as an empty file (which the gcd idempotency tests would happily compare as "identical"). - Mirror the ORFS-side fix (ORFS#4333) as bazel-orfs-patches/0036, adapted to the pinned ORFS_COMMIT, plus the flow/BUILD.bazel exports_files(scripts/synth.tcl) newer bazel-orfs needs. Both drop at the next ORFS bump. - Mirror bazel-orfs's sed single_version_override (gnulib memchr.c vs glibc 2.41+); non-root overrides don't apply, same story as the existing scip tinycthread patch. No-op on older glibc (CI). bazelisk test //test/orfs/gcd/...: 9/9 pass, including all six gcd_idempotent_test_* stages. Co-Authored-By: Claude Fable 5 Signed-off-by: Øyvind Harboe --- MODULE.bazel | 20 ++++- MODULE.bazel.lock | 14 +-- .../0036-orfs-single-writer-1_synth-sdc.patch | 86 +++++++++++++++++++ 3 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 bazel/bazel-orfs-patches/0036-orfs-single-writer-1_synth-sdc.patch diff --git a/MODULE.bazel b/MODULE.bazel index 614e8316f6b..89723b37c40 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -119,7 +119,7 @@ bazel_dep(name = "rules_nodejs", version = "6.7.3", dev_dependency = True) bazel_dep(name = "bazel-orfs", dev_dependency = True) bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True) -BAZEL_ORFS_COMMIT = "78f19f25cec73bdec3517a76465dec7ce17ce227" +BAZEL_ORFS_COMMIT = "d1a183aac249045372f5adab8efb8434efe53fdd" BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git" @@ -151,6 +151,9 @@ archive_override( patch_strip = 1, patches = [ "//bazel/bazel-orfs-patches:0035-fix-remove-non-root-overrides-from-MODULE.bazel.patch", + # Mirror of bazel-orfs patches/0037 (ORFS PR #4333), adapted to the + # ORFS_COMMIT pinned here. Drop at the next ORFS bump once #4333 lands. + "//bazel/bazel-orfs-patches:0036-orfs-single-writer-1_synth-sdc.patch", ], sha256 = "8325c6755215857a87a84db078d47dfbb2dfcbef70eaf0dd376fe5a7a363cd58", strip_prefix = "OpenROAD-flow-scripts-" + ORFS_COMMIT, @@ -264,3 +267,18 @@ single_version_override( patches = ["//bazel:scip_tinycthread_tny_prefix.patch"], version = "9.2.3", ) + +# sed-4.9's gnulib lib/memchr.c only `#undef memchr` inside glibc's own +# build (_LIBC); on glibc 2.41+ defines memchr as a _Generic +# macro, so the `__memchr (...)` function header expands into +# "_Generic(...)(...)" and clang rejects it. Force the undef to run +# unconditionally. Mirrored from bazel-orfs's MODULE.bazel: sed is pulled +# in via bazel-orfs, whose single_version_override is ignored when +# OpenROAD is the root module. +single_version_override( + module_name = "sed", + patch_cmds = [ + "sed -i 's|^#ifdef _LIBC$|#if 1|' lib/memchr.c", + ], + version = "4.9.bcr.5", +) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index ae11b47124c..9bd27ffce60 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -517,6 +517,7 @@ "https://bcr.bazel.build/modules/or-tools/9.15/MODULE.bazel": "8fbef0fbc8b0dd12feece54228b1cf8fc74bc20879715a4c6aa1dda0115ed6b1", "https://bcr.bazel.build/modules/or-tools/9.15/source.json": "02a81ec210d571aa98bf116a91a512c0dd2d8509ab64c30f113eb5674280ea31", "https://bcr.bazel.build/modules/package_metadata/0.0.2/MODULE.bazel": "fb8d25550742674d63d7b250063d4580ca530499f045d70748b1b142081ebb92", + "https://bcr.bazel.build/modules/package_metadata/0.0.3/MODULE.bazel": "77890552ecea9e284b5424c9de827a58099348763a4359e975c359a83d4faa83", "https://bcr.bazel.build/modules/package_metadata/0.0.6/MODULE.bazel": "341dab6f417197494517d54c8e557c0baee1de7aec83543a4fbefe57900acb7e", "https://bcr.bazel.build/modules/package_metadata/0.0.6/source.json": "9581d8b22db43550ac75ecc314ee4fa0a33400bfdc77d1317d8af6b18dca7756", "https://bcr.bazel.build/modules/pcre2/10.43/MODULE.bazel": "08eaa025111bd0fedc14a8187c2905fa6ee4501fbe558193e9bf6cc3e2cdf23c", @@ -531,7 +532,8 @@ "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", "https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc", "https://bcr.bazel.build/modules/platforms/1.0.0/MODULE.bazel": "f05feb42b48f1b3c225e4ccf351f367be0371411a803198ec34a389fb22aa580", - "https://bcr.bazel.build/modules/platforms/1.0.0/source.json": "f4ff1fd412e0246fd38c82328eb209130ead81d62dcd5a9e40910f867f733d96", + "https://bcr.bazel.build/modules/platforms/1.1.0/MODULE.bazel": "1c0c09f5bdcf4b3f924720d2478a3711cb39f4977019ca5988685e5b7e18b3d2", + "https://bcr.bazel.build/modules/platforms/1.1.0/source.json": "fcf351c47596c939140ab0d333dfdd08ed1ea6ce33c2fe70c12493a301cf1344", "https://bcr.bazel.build/modules/prometheus-cpp/1.2.4/MODULE.bazel": "0fbe5dcff66311947a3f6b86ebc6a6d9328e31a28413ca864debc4a043f371e5", "https://bcr.bazel.build/modules/prometheus-cpp/1.3.0/MODULE.bazel": "ce82e086bbc0b60267e970f6a54b2ca6d0f22d3eb6633e00e2cc2899c700f3d8", "https://bcr.bazel.build/modules/prometheus-cpp/1.3.0/source.json": "8cb66b4e535afc718e9d104a3db96ccb71a42ee816a100e50fd0d5ac843c0606", @@ -768,8 +770,8 @@ "https://bcr.bazel.build/modules/rules_verilog/1.1.1/source.json": "32a02fe6f97e1a233cff48e0eae70243e2e25d4c57fc684f933e06ef67440d8b", "https://bcr.bazel.build/modules/scip/9.2.3/MODULE.bazel": "392d8e76efeab5ef5978e66d15c2ce5e2607b80ea0804163861dd721eed93121", "https://bcr.bazel.build/modules/scip/9.2.3/source.json": "5ffc88567e8ff0f3ef59f20364af7cf903108f137fe36420f380e38b6cc92cb1", - "https://bcr.bazel.build/modules/sed/4.9.bcr.3/MODULE.bazel": "3aca45895b85b6ef65366cc12a45217ba6870f8931d2d62e09c99c772d9736ab", - "https://bcr.bazel.build/modules/sed/4.9.bcr.3/source.json": "31c0cf4c135ed3fa58298cd7bcfd4301c54ea4cf59d7c4e2ea0a180ce68eb34f", + "https://bcr.bazel.build/modules/sed/4.9.bcr.5/MODULE.bazel": "aa15eaf52261c9ead26a894939afe906511c9316970451a80806da73dbb2d1be", + "https://bcr.bazel.build/modules/sed/4.9.bcr.5/source.json": "a8f0b18e59882ed5a5c9293c960f5ffa01f14cec660fe4f997f77a61716f9d18", "https://bcr.bazel.build/modules/soplex/7.1.4.bcr.1/MODULE.bazel": "dbba514d47728de2ebd08ca7d02ee9bb3d6349dee1b4fbe78f6f15694acb94ff", "https://bcr.bazel.build/modules/soplex/7.1.4.bcr.1/source.json": "ca82ab37a51da4880fdf49c2f75531368033d7c50833b621025293b25e74b13c", "https://bcr.bazel.build/modules/spdlog/1.15.1/MODULE.bazel": "ac00f1ace2e0ec518f1cdcfd41b3f016e8257186d015324e33a5644149a9c327", @@ -824,7 +826,8 @@ "https://bcr.bazel.build/modules/yosys-slang/0.0.0/MODULE.bazel": "a0c2d49792cb5e49db7871aef6b1c022188fbda6023450da1d7a040ce6e02b9e", "https://bcr.bazel.build/modules/yosys-slang/0.0.0/source.json": "9de60d310212a28c1fdc5a2b4260466a0fa697b79ecf2505aa1389a8cd06c30d", "https://bcr.bazel.build/modules/yosys/0.62.bcr.2/MODULE.bazel": "2297c50983665b308449febf965616d11c28ce70ef04829f7a4de97d5d537726", - "https://bcr.bazel.build/modules/yosys/0.62.bcr.2/source.json": "72bf96ef1d9c881889e8e31e9a2af5f3bbbe5c18d83712e5ece7899f1d87655f", + "https://bcr.bazel.build/modules/yosys/0.64/MODULE.bazel": "9a15b6f9fc337d3d6b071977a7610365ea4646bc16bb7c6c82c8191806306862", + "https://bcr.bazel.build/modules/yosys/0.64/source.json": "dc88b5cc527c8fd2b8200e4043804e9a8c91428a07e8a3d2d5c08334101a075a", "https://bcr.bazel.build/modules/yq.bzl/0.1.1/MODULE.bazel": "9039681f9bcb8958ee2c87ffc74bdafba9f4369096a2b5634b88abc0eaefa072", "https://bcr.bazel.build/modules/yq.bzl/0.3.2/MODULE.bazel": "0384efa70e8033d842ea73aa4b7199fa099709e236a7264345c03937166670b6", "https://bcr.bazel.build/modules/yq.bzl/0.3.2/source.json": "c4ec3e192477e154f08769e29d69e8fd36e8a4f0f623997f3e1f6f7d328f7d7d", @@ -1019,7 +1022,7 @@ }, "@@bazel-orfs+//:extension.bzl%orfs_repositories": { "general": { - "bzlTransitiveDigest": "n442YWYaiLaZmB140K7YjK80SbojjoPPnbiBKSmFuSk=", + "bzlTransitiveDigest": "PiFNsx6zLPIQwlQMHvsxUEYoixU6E6reVnyNpRv/mcI=", "usagesDigest": "3/2frkS50u3iPaTVPzc49SDaZmcRsNFg/KHB0xlzlBw=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -1041,6 +1044,7 @@ "makefile": "@@orfs+//flow:makefile", "makefile_yosys": "@@orfs+//flow:makefile_yosys", "openroad": "@@//:openroad", + "openroad_qt": "@@//:openroad-qt", "opensta": "@@//src/sta:opensta", "pdk": "@@orfs+//flow:asap7", "yosys": "@@yosys+//:yosys", diff --git a/bazel/bazel-orfs-patches/0036-orfs-single-writer-1_synth-sdc.patch b/bazel/bazel-orfs-patches/0036-orfs-single-writer-1_synth-sdc.patch new file mode 100644 index 00000000000..8100e77f6c6 --- /dev/null +++ b/bazel/bazel-orfs-patches/0036-orfs-single-writer-1_synth-sdc.patch @@ -0,0 +1,86 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=98yvind=20Harboe?= +Date: Mon, 6 Jul 2026 11:17:45 +0200 +Subject: [PATCH] synth: single writer for 1_synth.sdc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Variant of ORFS PR #4333 against the ORFS_COMMIT pinned here +(no synth_syn.tcl at this commit), plus the flow/BUILD.bazel +exports_files(scripts/synth.tcl) that newer bazel-orfs needs for +its _synth_tcl attr (already on ORFS master). Drop this patch at +the next ORFS bump once #4333 lands. + +Signed-off-by: Øyvind Harboe +--- + flow/BUILD.bazel | 9 +++++++++ + flow/scripts/synth.tcl | 4 ---- + flow/scripts/synth_odb.tcl | 9 ++++++--- + flow/scripts/synth_preamble.tcl | 1 - + 4 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/flow/BUILD.bazel b/flow/BUILD.bazel +index 62e012594..41add0830 100644 +--- a/flow/BUILD.bazel ++++ b/flow/BUILD.bazel +@@ -5,6 +5,15 @@ exports_files( + visibility = ["//visibility:public"], + ) + ++# Expose synth.tcl as an addressable source label so bazel-orfs can ++# point its `_synth_tcl` attr default at `@orfs//flow:scripts/synth.tcl` ++# instead of vendoring its own (drifting) copy at the bazel-orfs repo ++# root. See bazel-orfs `private/rules.bzl`. ++exports_files( ++ ["scripts/synth.tcl"], ++ visibility = ["//visibility:public"], ++) ++ + # files shared between scripts/synth.sh and scripts/flow.sh steps + MAKEFILE_SHARED = [ + "scripts/variables.json", +diff --git a/flow/scripts/synth.tcl b/flow/scripts/synth.tcl +index 1c9e548c5..25a0728fd 100644 +--- a/flow/scripts/synth.tcl ++++ b/flow/scripts/synth.tcl +@@ -273,7 +273,3 @@ if { + + # Write synthesized design + write_verilog -nohex -nodec $::env(RESULTS_DIR)/1_2_yosys.v +-# One day a more sophisticated synthesis will write out a modified +-# .sdc file after synthesis. For now, just copy the input .sdc file, +-# making synthesis more consistent with other stages. +-log_cmd exec cp $::env(SDC_FILE) $::env(RESULTS_DIR)/1_synth.sdc +diff --git a/flow/scripts/synth_odb.tcl b/flow/scripts/synth_odb.tcl +index d6f53cda3..d0abab512 100644 +--- a/flow/scripts/synth_odb.tcl ++++ b/flow/scripts/synth_odb.tcl +@@ -25,9 +25,12 @@ source_step_tcl PRE SYNTH + log_cmd eliminate_dead_logic + + source_step_tcl POST SYNTH +-orfs_write_db $::env(RESULTS_DIR)/1_synth.odb ++# Producing 1_synth.odb/.sdc is this step's contract: ++# unconditional, no WRITE_ODB_AND_SDC_EACH_STAGE. ++log_cmd write_db $::env(RESULTS_DIR)/1_synth.odb + # Canonicalize 1_synth.sdc. The original SDC_FILE provided by + # the user could have dependencies, such as sourcing util.tcl, + # which are read in here and a canonicalized version is written +-# out by OpenSTA that has no dependencies. +-orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc ++# out by OpenSTA that has no dependencies. Sole writer of ++# 1_synth.sdc. ++log_cmd write_sdc -no_timestamp $::env(RESULTS_DIR)/1_synth.sdc +diff --git a/flow/scripts/synth_preamble.tcl b/flow/scripts/synth_preamble.tcl +index af43512c0..58c016a7a 100644 +--- a/flow/scripts/synth_preamble.tcl ++++ b/flow/scripts/synth_preamble.tcl +@@ -14,7 +14,6 @@ if { [env_var_exists_and_non_empty SYNTH_NETLIST_FILES] } { + # keep things simple we just use the creation date + log_cmd exec cat {*}$::env(SYNTH_NETLIST_FILES) > $::env(RESULTS_DIR)/1_2_yosys.v + } +- log_cmd exec cp -p $::env(SDC_FILE) $::env(RESULTS_DIR)/1_synth.sdc + if { [env_var_exists_and_non_empty CACHED_REPORTS] } { + log_cmd exec cp -p {*}$::env(CACHED_REPORTS) $::env(REPORTS_DIR)/. + } From 5bd39c2f4255de39c0b50fc0d70a0d2db30beee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 6 Jul 2026 12:38:56 +0200 Subject: [PATCH 2/3] bazel: fix yosys-slang BCR integrity drift, portable sed patch_cmds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BCR's yosys-slang 0.0.0 source.json pins the GitHub tarball of povik/yosys-slang@6760afa2; after the repo's rename GitHub regenerated that tarball (new bytes, top-level dir now sv-elab-), so any fresh fetch fails the integrity check (Check-Bazel-Lock). archive_override the same commit with the corrected integrity and strip_prefix; extracted content verified byte-identical to the upstream git tree. Drop once BCR publishes a fixed entry. Use sed -i.bak in the sed override's patch_cmds so BSD sed on macOS accepts it (review feedback). Co-Authored-By: Claude Fable 5 Signed-off-by: Øyvind Harboe --- MODULE.bazel | 17 ++++++++++++++++- MODULE.bazel.lock | 4 +--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 89723b37c40..a1c97e31e93 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -163,6 +163,19 @@ archive_override( bazel_dep(name = "yosys", version = "0.62.bcr.2", dev_dependency = True) bazel_dep(name = "yosys-slang", version = "0.0.0", dev_dependency = True) +# BCR's yosys-slang 0.0.0 source.json points at the GitHub tarball of +# povik/yosys-slang@6760afa2; after the repo's rename GitHub regenerated +# that tarball (new bytes, top-level dir now sv-elab-), so fresh +# fetches fail BCR's integrity check. Same commit, content verified +# identical to the git tree; only integrity and strip_prefix corrected. +# Drop once BCR publishes a fixed yosys-slang entry. +archive_override( + module_name = "yosys-slang", + integrity = "sha256-NBmPLtey0xdcPOPJ+xxskfKNvP5THZe5HWsSxIQxve8=", + strip_prefix = "sv-elab-6760afa2c9b9ba231a9c6a9e94f0939dd39f0a20", + urls = ["https://github.com/povik/yosys-slang/archive/6760afa2c9b9ba231a9c6a9e94f0939dd39f0a20.tar.gz"], +) + # --- Extensions --- llvm = use_extension( @@ -278,7 +291,9 @@ single_version_override( single_version_override( module_name = "sed", patch_cmds = [ - "sed -i 's|^#ifdef _LIBC$|#if 1|' lib/memchr.c", + # -i.bak (not bare -i) so BSD sed on macOS accepts it too. + "sed -i.bak 's|^#ifdef _LIBC$|#if 1|' lib/memchr.c", + "rm lib/memchr.c.bak", ], version = "4.9.bcr.5", ) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 9bd27ffce60..186c3c30f4e 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -823,8 +823,6 @@ "https://bcr.bazel.build/modules/xorgproto/2024.1.bcr.1/source.json": "2da7b346f94c7d5bb890d8a964110b38b439bd254ad14ec3d37022a7ac9356d8", "https://bcr.bazel.build/modules/yaml-cpp/0.9.0/MODULE.bazel": "d0841e12e92973d7e4c97557198335788890dafa9487d6dc0f9b852053a6c5c0", "https://bcr.bazel.build/modules/yaml-cpp/0.9.0/source.json": "07a9973d6cee81c8bdb1902e8f90064a0ef9aa2262bffc4df2ed577956c08e1b", - "https://bcr.bazel.build/modules/yosys-slang/0.0.0/MODULE.bazel": "a0c2d49792cb5e49db7871aef6b1c022188fbda6023450da1d7a040ce6e02b9e", - "https://bcr.bazel.build/modules/yosys-slang/0.0.0/source.json": "9de60d310212a28c1fdc5a2b4260466a0fa697b79ecf2505aa1389a8cd06c30d", "https://bcr.bazel.build/modules/yosys/0.62.bcr.2/MODULE.bazel": "2297c50983665b308449febf965616d11c28ce70ef04829f7a4de97d5d537726", "https://bcr.bazel.build/modules/yosys/0.64/MODULE.bazel": "9a15b6f9fc337d3d6b071977a7610365ea4646bc16bb7c6c82c8191806306862", "https://bcr.bazel.build/modules/yosys/0.64/source.json": "dc88b5cc527c8fd2b8200e4043804e9a8c91428a07e8a3d2d5c08334101a075a", @@ -2525,7 +2523,7 @@ "@@yosys-slang+//:dependency_support/slang_ext.bzl%vendored_slang_extension": { "general": { "bzlTransitiveDigest": "5QIB1e5+v5Cj2rslpyAj2M5L+l6B1BFByldLM+ewKMA=", - "usagesDigest": "bNfWY5+YI9i3FTlUQx6/VFcWZJN2hVi9BG7IvG4OGf4=", + "usagesDigest": "i6tCm4G6czTrDX7zkosKiwqamw1Y9s/ogPY7nwt3S9o=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, From ebf04d5f61ba1ad02232027dd3444897c2431feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 6 Jul 2026 15:20:12 +0200 Subject: [PATCH 3/3] bazel: point BAZEL_ORFS_COMMIT at merged bazel-orfs main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bazel-orfs#754 squash-merged as 90ad965f (identical tree to the PR-head commit pinned before); pin the SHA that stays reachable. Co-Authored-By: Claude Fable 5 Signed-off-by: Øyvind Harboe --- MODULE.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MODULE.bazel b/MODULE.bazel index a1c97e31e93..b0f8e6d7df5 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -119,7 +119,7 @@ bazel_dep(name = "rules_nodejs", version = "6.7.3", dev_dependency = True) bazel_dep(name = "bazel-orfs", dev_dependency = True) bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True) -BAZEL_ORFS_COMMIT = "d1a183aac249045372f5adab8efb8434efe53fdd" +BAZEL_ORFS_COMMIT = "90ad965f712f5317b67e08afd84e66425fcf6dd5" BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"