diff --git a/.bazelrc b/.bazelrc index 1e8a491897f..f1bede0caee 100644 --- a/.bazelrc +++ b/.bazelrc @@ -96,9 +96,13 @@ common --enable_platform_specific_config # macOS: boost.stacktrace needs this since backtrace() doesn't require GNU source build:macos --copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED build:macos --host_copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED -# Aligned allocation/deallocation for abseil is only available since 10.13 -build:macos --macos_minimum_os=10.13 -build:macos --host_macos_minimum_os=10.13 +# Floating-point std::to_chars (behind std::format, used by OpenSTA) +# needs macOS 13.3; std::filesystem (src/tcl_readline_setup.cc) needs +# 10.15; abseil's aligned allocation needs 10.13. The historical 10.13 +# floor was never enforced: toolchains_llvm ignored it and compiled +# against the host SDK's default. hermetic-llvm honors it. +build:macos --macos_minimum_os=13.3 +build:macos --host_macos_minimum_os=13.3 # Settings for --config=asan address sanitizer build build:asan --strip=never @@ -123,6 +127,9 @@ build:profile --copt -fno-omit-frame-pointer --host_copt -fno-omit-frame-pointer # Improve hermeticity by disallowing user envars and network access build --incompatible_strict_action_env build --nosandbox_default_allow_network +# Refuse to autodetect a local C++ toolchain (/usr/bin/gcc); the hermetic +# toolchain must win resolution, with or without the etc/bazel-hermetic wrapper. +common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 test --build_tests_only @@ -142,6 +149,11 @@ build:ci --disk_cache= # Tell the 'ci' config to include 'opt' build:ci --config=opt +# Launch py_binary via a shell stub instead of rules_python's legacy python +# stub, whose '#!/usr/bin/env python3' shebang needs a host python3 before +# the hermetic interpreter takes over (found by etc/bazel-hermetic). +common --@rules_python//python/config_settings:bootstrap_impl=script + # Setup remote cache # Anon: HTTPS read-only cache build --remote_cache=https://bazel.precisioninno.com diff --git a/MODULE.bazel b/MODULE.bazel index 6dbd6dea82a..e7fbf0e5934 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -34,19 +34,35 @@ bazel_dep(name = "rules_python", version = "1.8.5") bazel_dep(name = "rules_shell", version = "0.6.1") bazel_dep(name = "swig", version = "4.3.0.bcr.2") -# bison is transitive (rules_bison -> bison). Its vendored gnulib headers -# deliberately shadow libc headers; under toolchains that inject libc -# headers as leading -isystem entries (hermetic-llvm, #10812) the shadowing -# breaks and bison@3.8.2.bcr.5 fails to compile (O_BINARY, BCR #7642). -# 3.8.2.bcr.7 fixes most of it (a small remainder is patched in #10812 -# pending a proposed 3.8.2.bcr.8). +# bison is transitive (rules_bison -> bison). Same gnulib libc-header +# shadowing class as sed/gawk/m4 under hermetic-llvm (BCR #7642). +# 3.8.2.bcr.7 fixes lib/ but src/ still picks up raw libc headers; the +# patch restores gnulib wrapper-header precedence via -I (to be proposed +# upstream as 3.8.2.bcr.8, then drop). single_version_override( module_name = "bison", + patch_strip = 1, + patches = [ + "//bazel/bison-patches:0001-gnulib-wrapper-headers-use-I-not-isystem.patch", + ], version = "3.8.2.bcr.7", ) BOOST_VERSION = "1.89.0.bcr.2" +# boost::icl's exclusive_less_than comparator violates strict weak ordering +# (boostorg/icl#51); libc++'s std::map exposes it, leaving phantom intervals +# after interval_set subtraction (boostorg/icl#55) — pad IO fillers were +# placed on top of pads. Upstream fix boostorg/icl@7de3f55655 (#54), merged +# after boost 1.90. Drop when a boost.icl release containing it lands in BCR. +single_version_override( + module_name = "boost.icl", + patch_strip = 1, + patches = [ + "//bazel/boost-icl-patches:0001-refactor-interval-lookup-operations-icl-54.patch", + ], +) + bazel_dep(name = "boost.algorithm", version = BOOST_VERSION) bazel_dep(name = "boost.asio", version = BOOST_VERSION) bazel_dep(name = "boost.beast", version = BOOST_VERSION) @@ -88,11 +104,10 @@ bazel_dep(name = "cudd", version = "3.0.0.bcr.2") bazel_dep(name = "eigen", version = "3.4.0.bcr.3") bazel_dep(name = "fmt", version = "11.2.0.bcr.1") -# gawk is transitive (abc -> ncurses -> gawk; yosys -> gawk). Its vendored -# gnulib headers deliberately shadow libc headers; under toolchains that -# inject libc headers as leading -isystem entries (hermetic-llvm, #10812) -# the shadowing breaks and gawk fails to compile (BCR #7642). -# 5.3.2.bcr.7 carries the upstream BCR fix (BCR #7989). +# gawk is transitive (abc -> ncurses -> gawk; yosys -> gawk). Same gnulib +# libc-header shadowing as sed: gawk@5.3.2.bcr.2 fails to compile against +# hermetic-llvm's explicit libc -isystem entries (BCR #7642). 5.3.2.bcr.7 +# carries the upstream fix (BCR #7989). single_version_override( module_name = "gawk", version = "5.3.2.bcr.7", @@ -101,11 +116,8 @@ single_version_override( bazel_dep(name = "git", version = "2.54.0") bazel_dep(name = "googletest", version = "1.17.0.bcr.2") -# m4 is transitive (rules_bison/rules_flex -> m4). Its vendored gnulib -# headers deliberately shadow libc headers; under toolchains that inject -# libc headers as leading -isystem entries (hermetic-llvm, #10812) the -# shadowing breaks and m4@1.4.21 fails to compile (O_SEARCH, BCR #7642). -# 1.4.21.bcr.4 carries the upstream fix. +# m4 is transitive (rules_bison/rules_flex -> m4). Same gnulib libc-header +# shadowing class as sed/gawk under hermetic-llvm (BCR #7642). single_version_override( module_name = "m4", version = "1.4.21.bcr.4", @@ -113,9 +125,32 @@ single_version_override( bazel_dep(name = "openmp", version = "21.1.5.bcr.2") bazel_dep(name = "or-tools", version = "9.15") + +# sed is transitive (abc -> ncurses -> sed). Its vendored gnulib headers +# deliberately shadow libc headers (stdio.h, error.h); hermetic-llvm's +# explicit libc -isystem entries outrank them and sed@4.9.bcr.3 fails to +# compile (BCR #7642). 4.9.bcr.5 carries the upstream fix (BCR #7915). +single_version_override( + module_name = "sed", + version = "4.9.bcr.5", +) + bazel_dep(name = "spdlog", version = "1.15.1") bazel_dep(name = "sv-lang", version = "10.0.1-20260316-f04e8156") bazel_dep(name = "tcl_lang", version = "9.0.2.bcr.1") + +# tclZipfs.c's '#include "crypt.h"' picks up glibc's crypt.h instead of the +# vendored minizip one when glibc headers are explicit -isystem directories +# (hermetic-llvm zero-sysroot toolchain). Drop when fixed in a tcl_lang +# BCR release. +single_version_override( + module_name = "tcl_lang", + patch_strip = 1, + patches = [ + "//bazel/tcl-patches:0001-tclZipfs-include-vendored-minizip-crypt.h-by-path.patch", + ], +) + bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552") bazel_dep(name = "yaml-cpp", version = "0.9.0") bazel_dep(name = "zlib", version = "1.3.1.bcr.8") @@ -134,7 +169,12 @@ git_override( ## Lock the compiler version and avoid any local compiler. ## Downstream consumers must configure their own C++ toolchain. -bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True) +## +## hermetic-llvm (BCR module "llvm") provides statically linked LLVM +## binaries and a zero-sysroot cc_toolchain: no host compiler, linker, +## libxml2 or /usr/include involved, and it runs unmodified on distros +## without FHS paths (e.g. NixOS). +bazel_dep(name = "llvm", version = "0.8.11", dev_dependency = True) # --- Dev dependencies (not propagated to downstream consumers) --- @@ -201,23 +241,63 @@ archive_override( # --- Extensions --- -llvm = use_extension( - "@toolchains_llvm//toolchain/extensions:llvm.bzl", - "llvm", - dev_dependency = True, -) -llvm.toolchain( - llvm_version = "20.1.8", -) -use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm") - -# FYI: Comment out @llvm_toolchain//:all on NixOS and use the local clang toolchain instead. register_toolchains( - "@llvm_toolchain//:all", + "@llvm//toolchain:all", "@rules_verilator//verilator:verilator_toolchain", dev_dependency = True, ) +# hermetic-llvm ships a minimal macOS SDK subset (frameworks are opt-in). +# Qt (qt-bazel) needs the desktop frameworks; the first six entries are +# hermetic-llvm's defaults, which listing any framework replaces. +osx = use_extension("@llvm//extensions:osx.bzl", "osx", dev_dependency = True) +osx.frameworks(names = [ + "CoreFoundation", + "Foundation", + "Kernel", + "OSLog", + "Security", + "SystemConfiguration", + "AppKit", + "ApplicationServices", + "CFNetwork", + "Carbon", + "Cocoa", + "ColorSync", + "CoreData", + "CoreGraphics", + "CoreImage", + "CoreServices", + "CoreText", + "CoreVideo", + "DiskArbitration", + # ATS (inside the ApplicationServices umbrella) has .tbd symlinks into + # the FontServices private framework; without it they dangle and bazel + # rejects the sysroot ("file type is not supported"). + "FontServices", + "GSS", + "IOKit", + "IOSurface", + "ImageIO", + "Metal", + # MetalKit's MTKModel.h includes ModelIO/ModelIO.h. + "MetalKit", + "ModelIO", + "OpenGL", + # PrintCore is inside the ApplicationServices umbrella, but must be + # named for the SDK subset to keep usr/include/cups (its ObjC headers + # import ). + "PrintCore", + "QuartzCore", + # AppKit reaches these on macOS: NSImageView.h includes Symbols + # unconditionally; NSText*.h take the non-UIKit branch into the + # UIFoundation private framework; NSSharingService pulls CloudKit. + "CloudKit", + "Symbols", + "UIFoundation", + "UniformTypeIdentifiers", +]) + python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain( ignore_root_user_error = True, diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index a56525fb603..ddbd74a4f30 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -86,9 +86,11 @@ "https://bcr.bazel.build/modules/bazel_features/1.39.0/MODULE.bazel": "28739425c1fc283c91931619749c832b555e60bcd1010b40d8441ce0a5cf726d", "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", "https://bcr.bazel.build/modules/bazel_features/1.41.0/MODULE.bazel": "6e0f87fafed801273c371d41e22a15a6f8abf83fdd7f87d5e44ad317b94433d0", + "https://bcr.bazel.build/modules/bazel_features/1.42.0/MODULE.bazel": "e8ca15cb2639c5f12183db6dcb678735555d0cdd739b32a0418b6532b5e565f8", "https://bcr.bazel.build/modules/bazel_features/1.43.0/MODULE.bazel": "defa2226f06ba20550d6548c3a2ea2a7929634437a52973869c20c225450eb91", "https://bcr.bazel.build/modules/bazel_features/1.47.1/MODULE.bazel": "e6be691539341681678a68c2076771f6a73fcdc9823c5b6bf280d2e916d1ad80", - "https://bcr.bazel.build/modules/bazel_features/1.47.1/source.json": "fafffaa3e9b41de676a7a09268a020c2411fa685189e3749ad416e9206498577", + "https://bcr.bazel.build/modules/bazel_features/1.50.0/MODULE.bazel": "2083ef9c7a469f520890483ccf8e0189d6e71e2117e7752e15e6554433d5ae3e", + "https://bcr.bazel.build/modules/bazel_features/1.50.0/source.json": "e0ee3debde2789ff56e4452e612d126925ba9ab64d4bde79c67f099d2902df9b", "https://bcr.bazel.build/modules/bazel_features/1.9.0/MODULE.bazel": "885151d58d90d8d9c811eb75e3288c11f850e1d6b481a8c9f766adee4712358b", "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", "https://bcr.bazel.build/modules/bazel_lib/3.0.0-rc.0/MODULE.bazel": "d6e00979a98ac14ada5e31c8794708b41434d461e7e7ca39b59b765e6d233b18", @@ -483,6 +485,8 @@ "https://bcr.bazel.build/modules/libxau/1.0.12.bcr.1/source.json": "4076a85407185883f1563210abf36e80c9636d076d7197169bb431595b3f1151", "https://bcr.bazel.build/modules/libxcb/1.17.0.bcr.2/MODULE.bazel": "83d6740822a296210c0c60cd429a892934bdb237f7135eaf395b370c05af32a5", "https://bcr.bazel.build/modules/libxcb/1.17.0.bcr.2/source.json": "58c8c30c5d0f6253c94d7a38ab95fd5174683d613d47b9114520da6acef52ae8", + "https://bcr.bazel.build/modules/llvm/0.8.11/MODULE.bazel": "0f8c30b74be64f0e91764e925d0f562c70e8d85b6cea912f724d6b3753d6a33f", + "https://bcr.bazel.build/modules/llvm/0.8.11/source.json": "b40edb2bb2ed271bf613b396d245cb473c42fb057a2b26a3bc7d7e8bfcf6aa71", "https://bcr.bazel.build/modules/m4/1.4.21.bcr.4/MODULE.bazel": "40fef4b9091aea8e97b76a5706b3490b8d731ba008b02a883751ee2abf84daf4", "https://bcr.bazel.build/modules/m4/1.4.21.bcr.4/source.json": "c4add456cedd43c0c0d1329bd52120f8eedb6191c6d8299448bce1ed81be60a4", "https://bcr.bazel.build/modules/mbedtls/3.6.0/MODULE.bazel": "8e380e4698107c5f8766264d4df92e36766248447858db28187151d884995a09", @@ -625,8 +629,8 @@ "https://bcr.bazel.build/modules/rules_cc/0.2.16/MODULE.bazel": "9242fa89f950c6ef7702801ab53922e99c69b02310c39fb6e62b2bd30df2a1d4", "https://bcr.bazel.build/modules/rules_cc/0.2.17/MODULE.bazel": "1849602c86cb60da8613d2de887f9566a6d354a6df6d7009f9d04a14402f9a84", "https://bcr.bazel.build/modules/rules_cc/0.2.18/MODULE.bazel": "4460ec36adc8f722a6a2a4ac9374cb91f2acebadaa93fc37966129afb3dece87", - "https://bcr.bazel.build/modules/rules_cc/0.2.18/source.json": "abad668ff2fd63ada1ac49bf386d37e27048b89a3465a6fd968bb832b00a09d3", - "https://bcr.bazel.build/modules/rules_cc/0.2.2/MODULE.bazel": "a0656c5a8ff7f76bb1319ebf301bab9d94da5b48894cac25a14ed115f9dd0884", + "https://bcr.bazel.build/modules/rules_cc/0.2.20/MODULE.bazel": "f5c07bce5ddcb99be21a0812ff5aadb439e688b7449c6542152363b2fd859c1a", + "https://bcr.bazel.build/modules/rules_cc/0.2.20/source.json": "1155433dc6b8161bc339ce94095b337ed95feb1f048b014e10b62339d4b4239c", "https://bcr.bazel.build/modules/rules_cc/0.2.4/MODULE.bazel": "1ff1223dfd24f3ecf8f028446d4a27608aa43c3f41e346d22838a4223980b8cc", "https://bcr.bazel.build/modules/rules_cc/0.2.8/MODULE.bazel": "f1df20f0bf22c28192a794f29b501ee2018fa37a3862a1a2132ae2940a23a642", "https://bcr.bazel.build/modules/rules_cc/0.2.9/MODULE.bazel": "34263f1dca62ea664265438cef714d7db124c03e1ed55ebb4f1dc860164308d1", @@ -769,8 +773,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", @@ -794,24 +798,24 @@ "https://bcr.bazel.build/modules/swig/4.3.0/MODULE.bazel": "51619e147172c5380869cc90460b1c7fecfe21d6f566e97bc7ecf61244bdc7b8", "https://bcr.bazel.build/modules/systemc/3.0.2/MODULE.bazel": "7c4283e827307eb8eedfcba74f500f114e248916d948a2cdc45971818f3fde0d", "https://bcr.bazel.build/modules/systemc/3.0.2/source.json": "47370abd3ed04ce3c1a65a5b87c973e3e80e7e10e6b1dca2f15076f612d86d4c", + "https://bcr.bazel.build/modules/tar.bzl/0.10.4/MODULE.bazel": "e8f9ff79199e8d9eaad7f1b0a77ad74b30bb82d794b87d8ca942bead5de83ae9", + "https://bcr.bazel.build/modules/tar.bzl/0.10.4/source.json": "20143442376c03426f6135292ba02d825cb75308aa47e6bf42dd4cc5a435c2ff", "https://bcr.bazel.build/modules/tar.bzl/0.2.1/MODULE.bazel": "52d1c00a80a8cc67acbd01649e83d8dd6a9dc426a6c0b754a04fe8c219c76468", "https://bcr.bazel.build/modules/tar.bzl/0.5.1/MODULE.bazel": "7c2eb3dcfc53b0f3d6f9acdfd911ca803eaf92aadf54f8ca6e4c1f3aee288351", "https://bcr.bazel.build/modules/tar.bzl/0.5.5/MODULE.bazel": "4bfab9bbc7a1966c2c5f7371f5848f5e2d27c465951b4435adc9aaf00ed681da", "https://bcr.bazel.build/modules/tar.bzl/0.6.0/MODULE.bazel": "a3584b4edcfafcabd9b0ef9819808f05b372957bbdff41601429d5fd0aac2e7c", - "https://bcr.bazel.build/modules/tar.bzl/0.6.0/source.json": "4a620381df075a16cb3a7ed57bd1d05f7480222394c64a20fa51bdb636fda658", "https://bcr.bazel.build/modules/tcl_lang/8.6.16.bcr.1/MODULE.bazel": "1fc27ececc903378b88ad5a0b92d2675b54fe3add9bcc27d612195bd823c2f2d", "https://bcr.bazel.build/modules/tcl_lang/9.0.2.bcr.1/MODULE.bazel": "43ade6ad42bac483f82f02c6705a0b7afe021908d2719433bcddcb5ab98e73a1", "https://bcr.bazel.build/modules/tcl_lang/9.0.2.bcr.1/source.json": "fac478c17b901d1b168339ed49881e5883fac98bb9397586300d3ca2ed5cefa8", "https://bcr.bazel.build/modules/tcmalloc/0.0.0-20250927-12f2552/MODULE.bazel": "b702a6b6806b1041d84918c5098b765b204261647f8cb3e75e0f439106b65ddd", "https://bcr.bazel.build/modules/tcmalloc/0.0.0-20250927-12f2552/source.json": "a6f5da61dd65e3f2f7380b4f52dd4b0f771a5b6ba9db7b46be7c28c52bc7af58", - "https://bcr.bazel.build/modules/toolchains_llvm/1.5.0/MODULE.bazel": "31c7077ef64bafdf2dfb46d4bca321b4e8f143b00ac68b2c31f5ff0c91044b60", - "https://bcr.bazel.build/modules/toolchains_llvm/1.5.0/source.json": "aecbd0eea924f27bf8d33d3823f1427e1eddc826ff96425e4304b0d7ad6d7ffa", "https://bcr.bazel.build/modules/upb/0.0.0-20211020-160625a/MODULE.bazel": "6cced416be2dc5b9c05efd5b997049ba795e5e4e6fafbe1624f4587767638928", "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", "https://bcr.bazel.build/modules/upb/0.0.0-20230516-61a97ef/MODULE.bazel": "c0df5e35ad55e264160417fd0875932ee3c9dda63d9fccace35ac62f45e1b6f9", "https://bcr.bazel.build/modules/upb/0.0.0-20230907-e7430e6/MODULE.bazel": "3a7dedadf70346e678dc059dbe44d05cbf3ab17f1ce43a1c7a42edc7cbf93fd9", "https://bcr.bazel.build/modules/verilator/5.036.bcr.3/MODULE.bazel": "19ff7c6a9133f404157b0d499ff8c93bfc7e98e7e8d7569b51e50f79a5a33d1b", "https://bcr.bazel.build/modules/verilator/5.036.bcr.3/source.json": "d7aa35ef34334e9bf11ffc308c1fa7f44f313b45e4e80c497cbd26deb585bcbf", + "https://bcr.bazel.build/modules/with_cfg.bzl/0.12.0/MODULE.bazel": "b573395fe63aef4299ba095173e2f62ccfee5ad9bbf7acaa95dba73af9fc2b38", "https://bcr.bazel.build/modules/with_cfg.bzl/0.14.1/MODULE.bazel": "aa0ef3f6c67dd35db7ac38c76785dc02f48b53f34e16b20487e70f51b5324d0a", "https://bcr.bazel.build/modules/with_cfg.bzl/0.14.1/source.json": "4666d3035f69063ecd136f3f0c68e424f1b1dd97ffc9cceb679522c0be38761b", "https://bcr.bazel.build/modules/xcb-proto/1.17.0/MODULE.bazel": "13062923a9e615a2f4d284a3f28e467536f7abcfd79d2c04c2acf3837e9da31b", @@ -1851,7 +1855,7 @@ }, "@@rules_multitool+//multitool:extension.bzl%multitool": { "general": { - "bzlTransitiveDigest": "qu8DUXrJ5K4f1DfsSAZeWrV3/Ql9Hz6/qfrNyRbS+BQ=", + "bzlTransitiveDigest": "6xmws4Qtb2mS1rTiYu1itT8wHrwiyWAgWXUA+euChIk=", "usagesDigest": "ZVm5YLWTHZE8lFq+UcA2T2lhKEur8bIVk9tvjn8SO2U=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -2129,7 +2133,7 @@ }, "@@rules_rust+//crate_universe/private:internal_extensions.bzl%cu_nr": { "general": { - "bzlTransitiveDigest": "oC4bpY6gNOwGQgA89G1KbI0nQN1imFv3S6VKjWHcO3Y=", + "bzlTransitiveDigest": "Otq2Iebci1zuLjK+lEbK5I2Lz+3gYicIhW6OGuK94aI=", "usagesDigest": "dQ7SQZ7uSSL3vVKSMBKRxKJUm9OVrZZA+S1/QQfT570=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, @@ -2438,85 +2442,6 @@ ] } }, - "@@toolchains_llvm+//toolchain/extensions:llvm.bzl%llvm": { - "general": { - "bzlTransitiveDigest": "SFT0LhY0ioB2PsbncmTCGyGh8M0OtAJ2fCq0fHtf7ps=", - "usagesDigest": "ZuaBuvEE8efZLVQ2tR8Vbv3podpYbZjO703SKYIAb4g=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "llvm_toolchain_llvm": { - "repoRuleId": "@@toolchains_llvm+//toolchain:rules.bzl%llvm", - "attributes": { - "alternative_llvm_sources": [], - "auth_patterns": {}, - "distribution": "auto", - "exec_arch": "", - "exec_os": "", - "extra_llvm_distributions": {}, - "libclang_rt": {}, - "llvm_mirror": "", - "llvm_version": "20.1.8", - "llvm_versions": {}, - "netrc": "", - "sha256": {}, - "strip_prefix": {}, - "urls": {} - } - }, - "llvm_toolchain": { - "repoRuleId": "@@toolchains_llvm+//toolchain:rules.bzl%toolchain", - "attributes": { - "absolute_paths": false, - "archive_flags": {}, - "compile_flags": {}, - "conly_flags": {}, - "coverage_compile_flags": {}, - "coverage_link_flags": {}, - "cxx_builtin_include_directories": {}, - "cxx_flags": {}, - "cxx_standard": {}, - "dbg_compile_flags": {}, - "exec_arch": "", - "exec_os": "", - "extra_exec_compatible_with": {}, - "extra_target_compatible_with": {}, - "fastbuild_compile_flags": {}, - "link_flags": {}, - "link_libs": {}, - "llvm_versions": { - "": "20.1.8" - }, - "opt_compile_flags": {}, - "opt_link_flags": {}, - "stdlib": {}, - "target_settings": {}, - "unfiltered_compile_flags": {}, - "toolchain_roots": {}, - "sysroot": {} - } - } - }, - "recordedRepoMappingEntries": [ - [ - "toolchains_llvm+", - "bazel_skylib", - "bazel_skylib+" - ], - [ - "toolchains_llvm+", - "bazel_tools", - "bazel_tools" - ], - [ - "toolchains_llvm+", - "toolchains_llvm", - "toolchains_llvm+" - ] - ] - } - }, "@@yosys-slang+//:dependency_support/slang_ext.bzl%vendored_slang_extension": { "general": { "bzlTransitiveDigest": "5QIB1e5+v5Cj2rslpyAj2M5L+l6B1BFByldLM+ewKMA=", diff --git a/bazel/bison-patches/0001-gnulib-wrapper-headers-use-I-not-isystem.patch b/bazel/bison-patches/0001-gnulib-wrapper-headers-use-I-not-isystem.patch new file mode 100644 index 00000000000..feb39111526 --- /dev/null +++ b/bazel/bison-patches/0001-gnulib-wrapper-headers-use-I-not-isystem.patch @@ -0,0 +1,61 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Oyvind Harboe +Date: Mon, 6 Jul 2026 00:00:00 +0000 +Subject: [PATCH] BUILD: let gnulib wrapper headers shadow libc via -I + +Gnulib generates wrapper headers (lib/stdio.h, lib/fcntl.h, ...) that +must be found before the libc ones; they forward with #include_next and +add gnulib decorations (_GL_ATTRIBUTE_DEALLOC etc.) that lib/*-safer.h +and src/*.c rely on. The overlay's 'includes = ["lib"]' emits -isystem, +which loses to toolchains that inject libc headers as earlier -isystem +entries (e.g. the zero-sysroot hermetic-llvm BCR toolchain), and a dir +listed as both -I and -isystem is kept as -isystem, so the -I must +replace it, not merely accompany it. + +Plain -I outranks every -isystem, restoring autotools' AM_CPPFLAGS = +-I./lib ordering. $(BINDIR) covers the generated wrappers, the source +path the checked-in ones. + +Same class of fix as sed@4.9.bcr.5 (BCR #7915) and gawk@5.3.2.bcr.7 +(BCR #7989); to be proposed upstream as bison@3.8.2.bcr.8. +--- +diff --git a/BUILD.bazel b/BUILD.bazel +--- a/BUILD.bazel ++++ b/BUILD.bazel +@@ -711,7 +711,19 @@ + tags = ["manual"], + ) + +-BISON_COPTS = select({ ++# Gnulib's wrapper headers (generated lib/stdio.h, lib/fcntl.h, ... plus ++# the checked-in lib/*-safer.h helpers) must shadow the libc headers: they ++# forward via #include_next and add gnulib decorations ++# (_GL_ATTRIBUTE_DEALLOC etc.) that lib/ and src/ sources rely on. ++# `includes = ["lib"]` emits -isystem, which loses against toolchains that ++# inject libc headers as earlier -isystem entries (e.g. the zero-sysroot ++# hermetic-llvm BCR toolchain). Plain -I outranks every -isystem (and a dir ++# listed as both -I and -isystem stays -isystem, so the -isystem form must ++# go entirely). This restores autotools' AM_CPPFLAGS = -I./lib ordering. ++BISON_COPTS = [ ++ "-Iexternal/" + repo_name() + "/lib", ++ "-I$(BINDIR)/external/" + repo_name() + "/lib", ++] + select({ + "@rules_cc//cc/compiler:clang": [ + "-w", + "-std=c11", +@@ -813,7 +825,6 @@ + "src/scan-skel.c", + ":configmake_h_src", + ], +- includes = ["lib"], + textual_hdrs = [ + "lib/timevar.def", + "lib/printf-frexp.c", +@@ -997,6 +1008,7 @@ + "lib/main.c", + "lib/yyerror.c", + ], ++ copts = BISON_COPTS, + implementation_deps = [":headers"], + local_defines = LOCAL_DEFINES, + ) diff --git a/bazel/bison-patches/BUILD.bazel b/bazel/bison-patches/BUILD.bazel new file mode 100644 index 00000000000..d518110449e --- /dev/null +++ b/bazel/bison-patches/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.patch"])) diff --git a/bazel/boost-icl-patches/0001-refactor-interval-lookup-operations-icl-54.patch b/bazel/boost-icl-patches/0001-refactor-interval-lookup-operations-icl-54.patch new file mode 100644 index 00000000000..0923bba655b --- /dev/null +++ b/bazel/boost-icl-patches/0001-refactor-interval-lookup-operations-icl-54.patch @@ -0,0 +1,582 @@ +boost::icl's exclusive_less_than comparator violates strict weak +ordering (boostorg/icl#51), which libc++'s std::map exposes: +interval_set::operator-= subtracts only the first overlapping interval +and leaves phantom coverage (boostorg/icl#55). This is upstream commit +boostorg/icl@7de3f55655 ("Refactored interval lookup operations", #54), +merged after boost 1.90, trimmed to include/. Drop this patch when a +boost.icl release containing it lands in BCR. + +diff --git a/include/boost/icl/concept/element_associator.hpp b/include/boost/icl/concept/element_associator.hpp +index 98280ece..7c4cbfd3 100644 +--- a/include/boost/icl/concept/element_associator.hpp ++++ b/include/boost/icl/concept/element_associator.hpp +@@ -143,7 +143,7 @@ is_element_equal(const Type& left, const Type& right) + { return left == right; } + + +-/* Strict weak less ordering which is given by the Compare order */ ++/* Strict partial less ordering which is given by the Compare order */ + template + inline typename enable_if, bool>::type + operator < (const Type& left, const Type& right) +diff --git a/include/boost/icl/concept/interval.hpp b/include/boost/icl/concept/interval.hpp +index fab7dd99..3a1e69f9 100644 +--- a/include/boost/icl/concept/interval.hpp ++++ b/include/boost/icl/concept/interval.hpp +@@ -565,8 +565,10 @@ template + typename boost::enable_if, bool>::type + is_empty(const Type& object) + { +- return domain_less_equal(upper(object), lower(object) ) +- || domain_less_equal(upper(object), domain_next(lower(object))); ++ // we use ternary operator instead of || to prevent a codegen bug with GCC 10-11 ++ return domain_less_equal(upper(object), lower(object))? ++ true: ++ domain_less_equal(upper(object), domain_next(lower(object))); + } + + template +@@ -576,8 +578,10 @@ is_empty(const Type& object) + if(object.bounds() == interval_bounds::closed()) + return domain_less(upper(object), lower(object)); + else if(object.bounds() == interval_bounds::open()) +- return domain_less_equal(upper(object), lower(object) ) +- || domain_less_equal(upper(object), domain_next(lower(object))); ++ // we use ternary operator instead of || to prevent a codegen bug with GCC 10-11 ++ return domain_less_equal(upper(object), lower(object))? ++ true: ++ domain_less_equal(upper(object), domain_next(lower(object))); + else + return domain_less_equal(upper(object), lower(object)); + } +diff --git a/include/boost/icl/detail/assoc_container_adaptor.hpp b/include/boost/icl/detail/assoc_container_adaptor.hpp +new file mode 100644 +index 00000000..63e4975f +--- /dev/null ++++ b/include/boost/icl/detail/assoc_container_adaptor.hpp +@@ -0,0 +1,187 @@ ++/*-----------------------------------------------------------------------------+ ++Copyright (c) 2026: Joaquin M Lopez Munoz +++------------------------------------------------------------------------------+ ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENCE.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) +++-----------------------------------------------------------------------------*/ ++#ifndef BOOST_ICL_DETAIL_ASSOC_CONTAINER_ADAPTOR_HPP_JMLM_260320 ++#define BOOST_ICL_DETAIL_ASSOC_CONTAINER_ADAPTOR_HPP_JMLM_260320 ++ ++#include ++#include ++#include ++#include ++ ++namespace boost{namespace icl{namespace detail ++{ ++ ++/*-----------------------------------------------------------------------------+ ++| Interval comparison is generally a partial order rather than a strict weak | ++| order (SWO). This does not pose any problem with associative containers as | ++| long as the intervals in the container are disjoint, since the induced order | ++| restricted to those is a SWO (indeed, a total order). A difficulty may arise | ++| when doing a lookup operation for an interval k that overlaps with | ++| E = elements(container), as the induced order over {k} U E may not be a SWO. | ++| All stdlib implementations support this case except libc++ v22 or higher: | ++| https://github.com/llvm/llvm-project/issues/183189 | ++| https://github.com/boostorg/icl/issues/51 . | ++| Whether libc++'s behavior is conformant or not is contested, see | ++| https://github.com/llvm/llvm-project/issues/187667 , | ++| but, regardless, we can solve the problem by resorting to heterogeneous | ++| lookup. When k is of a type other than key_type and the compare predicate is | ++| transparent, lookup operations on k are defined by the standard in terms of | ++| elements being _partitioned_ by k, without any reference to SWO compliance. | ++| | ++| assoc_container_adaptor, in combination with transparent_compare, forces | ++| lookup operations on the adapted container to be routed through its | ++| heterogeneous lookup overloads, and does nothing for C++11 containers | ++| without het lookup. This circumvents libc++'s singular behavior except when | ++| in C++11 mode: in this case, we use Boost.Container, which supports het | ++| lookup even in C++11 (see impl_config.hpp). Insert functions are also | ++| provided that prevent UB when the element would violate SWO (this is UB | ++| regardless of the resolution of libc++'s issue). | ++| | ++| Additionally, Boost.ICL interval find functions are documented to return the | ++| _first_ eligible element, which is not guaranteed by std::(set|map)::find; | ++| assoc_container_adaptor fixes that. +++-----------------------------------------------------------------------------*/ ++ ++template ++struct transparent_compare: Compare ++{ ++ using is_transparent = void; ++ using super = Compare; ++ ++ using super::super; ++}; ++ ++template ++using assoc_container_is_set = std::is_same< ++ typename AssocContainer::key_type, typename AssocContainer::value_type>; ++ ++template ++using assoc_container_enable_if_is_input_iterator_t = ++ typename std::enable_if< ++ std::is_convertible< ++ typename std::iterator_traits::iterator_category, ++ std::input_iterator_tag ++ >::value ++ >::type; ++ ++template ++struct assoc_container_adaptor: AssocContainer ++{ ++ using key_type = typename AssocContainer::key_type; ++ using value_type = typename AssocContainer::value_type; ++ using size_type = typename AssocContainer::size_type; ++ using key_compare = typename AssocContainer::key_compare::super; ++ using iterator = typename AssocContainer::iterator; ++ using const_iterator = typename AssocContainer::const_iterator; ++ ++ using AssocContainer::AssocContainer; ++ ++ template< ++ typename InputIterator, ++ typename = assoc_container_enable_if_is_input_iterator_t ++ > ++ void insert(InputIterator first, InputIterator last) ++ { ++ while(first != last) insert(*first++); ++ } ++ ++ std::pair insert(const value_type& x) ++ { ++ auto it = lower_bound(key_from_value(x)); ++ if(it == AssocContainer::end() || AssocContainer::value_comp()(x, *it)) { ++ return {AssocContainer::insert(it, x), true}; ++ } ++ else { ++ return {it, false}; ++ } ++ } ++ ++ iterator insert(const_iterator pos, const value_type& x) ++ { ++ if((pos == AssocContainer::end() || AssocContainer::value_comp()(x, *pos)) && ++ (pos == AssocContainer::begin() || AssocContainer::value_comp()(*std::prev(pos), x))){ ++ return AssocContainer::insert(pos, x); ++ } ++ return insert(x).first; ++ } ++ ++ size_type count(const key_type& key) ++ { ++ return AssocContainer::count(std::cref(key)); ++ } ++ ++ size_type count(const key_type& key) const ++ { ++ return AssocContainer::count(std::cref(key)); ++ } ++ ++ iterator find(const key_type& key) ++ { ++ auto it = AssocContainer::lower_bound(std::cref(key)); ++ return ++ it == AssocContainer::end() || ++ AssocContainer::key_comp()(key, key_from_value(*it))? ++ AssocContainer::end(): it; ++ } ++ ++ const_iterator find(const key_type& key) const ++ { ++ return const_cast(this)->find(key); ++ } ++ ++ std::pair equal_range(const key_type& key) ++ { ++ return AssocContainer::equal_range(std::cref(key)); ++ } ++ ++ std::pair equal_range(const key_type& key) const ++ { ++ return AssocContainer::equal_range(std::cref(key)); ++ } ++ ++ iterator lower_bound(const key_type& key) ++ { ++ return AssocContainer::lower_bound(std::cref(key)); ++ } ++ ++ const_iterator lower_bound(const key_type& key) const ++ { ++ return AssocContainer::lower_bound(std::cref(key)); ++ } ++ ++ iterator upper_bound(const key_type& key) ++ { ++ return AssocContainer::upper_bound(std::cref(key)); ++ } ++ ++ const_iterator upper_bound(const key_type& key) const ++ { ++ return AssocContainer::upper_bound(std::cref(key)); ++ } ++ ++private: ++ template< ++ class IsSet = assoc_container_is_set, ++ typename std::enable_if::type* = nullptr> ++ static const key_type& key_from_value(const value_type& x) ++ { ++ return x; ++ } ++ ++ template< ++ class IsSet = assoc_container_is_set, ++ typename std::enable_if::type* = nullptr> ++ static const key_type& key_from_value(const value_type& x) ++ { ++ return x.first; ++ } ++}; ++ ++}}} // namespace detail icl boost ++ ++#endif +diff --git a/include/boost/icl/detail/element_iterator.hpp b/include/boost/icl/detail/element_iterator.hpp +index 6c06f494..d1f3c9e9 100644 +--- a/include/boost/icl/detail/element_iterator.hpp ++++ b/include/boost/icl/detail/element_iterator.hpp +@@ -8,11 +8,22 @@ Copyright (c) 2009-2009: Joachim Faulhaber + #ifndef BOOST_ICL_DETAIL_ELEMENT_ITERATOR_HPP_JOFA_091104 + #define BOOST_ICL_DETAIL_ELEMENT_ITERATOR_HPP_JOFA_091104 + ++#include + #include + #include + #include + #include + ++#if BOOST_CXX_VERSION >= 202002L ++#include ++#endif ++ ++namespace boost{namespace movelib{ ++ ++template class reverse_iterator; ++ ++}} // namespace movelib boost ++ + namespace boost{namespace icl + { + +@@ -62,6 +73,13 @@ struct is_reverse > + BOOST_STATIC_CONSTANT(bool, value = true); + }; + ++template ++struct is_reverse > ++{ ++ typedef is_reverse > type; ++ BOOST_STATIC_CONSTANT(bool, value = true); ++}; ++ + template + struct is_reverse > + { +@@ -333,6 +351,32 @@ class element_iterator + + }} // namespace icl boost + ++#if BOOST_CXX_VERSION >= 202002L ++// std::iter_value_t falls back to std::indirectly_readable_traits::value_type when ++// std::iterator_traits is not specialized, but std::indirectly_readable_traits is ++// ill-defined if It::value_type and It::element_type _both_ exist and are _not_ the same, which ++// is precisely the case for element_iterator. ++// Workaround is to specialize std::iterator_traits>. We do this ++// by deriving from std::iterator_traits>> so ++// that we don't have to revisit this ever even if more typedefs are added to std::iterator_traits ++// in future versions of the C++ standard. ++ ++namespace boost{namespace icl{namespace detail{ ++ ++template struct derived_wrapper: Class {}; ++ ++}}} // namespace detail icl boost ++ ++namespace std{ ++ ++template ++struct iterator_traits< ::boost::icl::element_iterator> : ++ iterator_traits< ::boost::icl::detail::derived_wrapper< ::boost::icl::element_iterator>> ++{}; ++ ++} // namespace std ++#endif ++ + #endif // BOOST_ICL_DETAIL_ELEMENT_ITERATOR_HPP_JOFA_091104 + + +diff --git a/include/boost/icl/detail/exclusive_less_than.hpp b/include/boost/icl/detail/exclusive_less_than.hpp +index 3a4aa650..fbdaa5f9 100644 +--- a/include/boost/icl/detail/exclusive_less_than.hpp ++++ b/include/boost/icl/detail/exclusive_less_than.hpp +@@ -17,7 +17,7 @@ namespace boost{ namespace icl + template + struct exclusive_less_than + { +- /** Operator operator() implements a strict weak ordering on intervals. */ ++ /** Operator operator() implements a strict partial ordering on intervals. */ + bool operator()(const IntervalT& left, const IntervalT& right)const + { + return icl::non_empty::exclusive_less(left, right); +diff --git a/include/boost/icl/detail/map_adaptor.hpp b/include/boost/icl/detail/map_adaptor.hpp +new file mode 100644 +index 00000000..790490ed +--- /dev/null ++++ b/include/boost/icl/detail/map_adaptor.hpp +@@ -0,0 +1,29 @@ ++/*-----------------------------------------------------------------------------+ ++Copyright (c) 2026: Joaquin M Lopez Munoz +++------------------------------------------------------------------------------+ ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENCE.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) +++-----------------------------------------------------------------------------*/ ++#ifndef BOOST_ICL_DETAIL_MAP_ADAPTOR_HPP_JMLM_260321 ++#define BOOST_ICL_DETAIL_MAP_ADAPTOR_HPP_JMLM_260321 ++ ++#include ++ ++#include ICL_IMPL_PATH(map) ++ ++// let boostdep know about this potential dependency hidden by ICL_IMPL_PATH ++#if 0 ++#include ++#endif ++ ++namespace boost{namespace icl{namespace detail ++{ ++ ++template ++using map_adaptor = assoc_container_adaptor< ++ ICL_IMPL_SPACE::map, Allocator>>; ++ ++}}} // namespace detail icl boost ++ ++#endif +diff --git a/include/boost/icl/detail/mapped_reference.hpp b/include/boost/icl/detail/mapped_reference.hpp +index 67f7d041..212059cb 100644 +--- a/include/boost/icl/detail/mapped_reference.hpp ++++ b/include/boost/icl/detail/mapped_reference.hpp +@@ -134,7 +134,7 @@ inline typename enable_if, bool>::type + operator == ( const StdPairT& left, + const mapped_reference& right) + { +- return right == left; ++ return right.operator ==(left); + } + + template +@@ -142,7 +142,7 @@ inline typename enable_if, bool>::type + operator != ( const StdPairT& left, + const mapped_reference& right) + { +- return !(right == left); ++ return !(right.operator ==(left)); + } + + //------------------------------------------------------------------------------ +diff --git a/include/boost/icl/detail/set_adaptor.hpp b/include/boost/icl/detail/set_adaptor.hpp +new file mode 100644 +index 00000000..2a44b8a5 +--- /dev/null ++++ b/include/boost/icl/detail/set_adaptor.hpp +@@ -0,0 +1,44 @@ ++/*-----------------------------------------------------------------------------+ ++Copyright (c) 2026: Joaquin M Lopez Munoz +++------------------------------------------------------------------------------+ ++ Distributed under the Boost Software License, Version 1.0. ++ (See accompanying file LICENCE.txt or copy at ++ http://www.boost.org/LICENSE_1_0.txt) +++-----------------------------------------------------------------------------*/ ++#ifndef BOOST_ICL_DETAIL_SET_ADAPTOR_HPP_JMLM_260321 ++#define BOOST_ICL_DETAIL_SET_ADAPTOR_HPP_JMLM_260321 ++ ++#include ++ ++#include ICL_IMPL_PATH(set) ++ ++// let boostdep know about this potential dependency hidden by ICL_IMPL_PATH ++#if 0 ++#include ++#endif ++ ++namespace boost{namespace icl{namespace detail ++{ ++ ++template ++struct set_adaptor: assoc_container_adaptor< ++ ICL_IMPL_SPACE::set, Allocator>> ++{ ++ using super = assoc_container_adaptor< ++ ICL_IMPL_SPACE::set, Allocator>>; ++ ++ using super::super; ++ ++ // Boost.ICL assumes set::iterator is the same type as set::const_iterator, ++ // which is not guaranteed generally and is certainly not the case for ++ // boost::container::set. We extend to reverse_iterator out of sympathy. ++ ++ using const_iterator = typename super::const_iterator; ++ using iterator = const_iterator; ++ using const_reverse_iterator = typename super::const_reverse_iterator; ++ using reverse_iterator = const_reverse_iterator; ++}; ++ ++}}} // namespace detail icl boost ++ ++#endif +diff --git a/include/boost/icl/impl_config.hpp b/include/boost/icl/impl_config.hpp +index 55297396..601d4bcc 100644 +--- a/include/boost/icl/impl_config.hpp ++++ b/include/boost/icl/impl_config.hpp +@@ -32,14 +32,19 @@ Copyright (c) 2009-2011: Joachim Faulhaber + | | + | NOTE: ICL_USE_BOOST_INTERPROCESS_IMPLEMENTATION: This define has been | + | available until boost version 1.48.0 and is no longer supported. | ++| | ++| NOTE: With libc++ v22 or higher in C++11, boost::container is used | ++| regardless of user indications. See assoc_container_adaptor.hpp for | ++| the rationale. | + +-----------------------------------------------------------------------------*/ + +-#if defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION) ++#if defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION) ||\ ++ (BOOST_CXX_VERSION < 201402L && defined(_LIBCPP_VERSION) && _LIBCPP_VERSION > 220000) + # define ICL_IMPL_SPACE boost::container +-#elif defined(ICL_USE_STD_IMPLEMENTATION) +-# define ICL_IMPL_SPACE std ++# define ICL_IMPL_PATH(header) + #else + # define ICL_IMPL_SPACE std ++# define ICL_IMPL_PATH(header)
+ #endif + + /*-----------------------------------------------------------------------------+ +diff --git a/include/boost/icl/interval_base_map.hpp b/include/boost/icl/interval_base_map.hpp +index f464a6a4..89555c7c 100644 +--- a/include/boost/icl/interval_base_map.hpp ++++ b/include/boost/icl/interval_base_map.hpp +@@ -19,6 +19,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin + #include + #include + #include ++#include + + #include + +@@ -145,8 +146,7 @@ class interval_base_map + allocator_type; + + /// Container type for the implementation +- typedef ICL_IMPL_SPACE::map ImplMapT; ++ typedef detail::map_adaptor ImplMapT; + + /// key type of the implementing container + typedef typename ImplMapT::key_type key_type; +diff --git a/include/boost/icl/interval_base_set.hpp b/include/boost/icl/interval_base_set.hpp +index d693bd43..a0b3968d 100644 +--- a/include/boost/icl/interval_base_set.hpp ++++ b/include/boost/icl/interval_base_set.hpp +@@ -11,14 +11,6 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin + + #include + +-#if defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION) +-# include +-#elif defined(ICL_USE_STD_IMPLEMENTATION) +-# include +-#else // Default for implementing containers +-# include +-#endif +- + #include + #include + #include +@@ -30,6 +22,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin + #include + #include + #include ++#include + + #include + #include +@@ -116,7 +109,7 @@ class interval_base_set + typedef Alloc domain_allocator_type; + + /// Container type for the implementation +- typedef typename ICL_IMPL_SPACE::set ImplSetT; ++ typedef detail::set_adaptor ImplSetT; + + /// key type of the implementing container + typedef typename ImplSetT::key_type key_type; +diff --git a/include/boost/icl/map.hpp b/include/boost/icl/map.hpp +index 3877745d..8d67de1e 100644 +--- a/include/boost/icl/map.hpp ++++ b/include/boost/icl/map.hpp +@@ -10,16 +10,8 @@ Copyright (c) 2007-2011: Joachim Faulhaber + + #include + +-#if defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION) +-# include +-# include +-#elif defined(ICL_USE_STD_IMPLEMENTATION) +-# include +-# include +-#else // Default for implementing containers +-# include +-# include +-#endif ++#include ++#include ICL_IMPL_PATH(set) + + #include + #include +@@ -89,14 +81,14 @@ template + ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT), + ICL_ALLOC Alloc = std::allocator + > +-class map: private ICL_IMPL_SPACE::map > > + { + public: + typedef Alloc > allocator_type; + + typedef typename icl::map type; +- typedef typename ICL_IMPL_SPACE::map base_type; + + typedef Traits traits; +diff --git a/include/boost/icl/set.hpp b/include/boost/icl/set.hpp +index db44b5e8..aa1a68ed 100644 +--- a/include/boost/icl/set.hpp ++++ b/include/boost/icl/set.hpp +@@ -10,13 +10,7 @@ Copyright (c) 2007-2011: Joachim Faulhaber + + #include + +-#if defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION) +-# include +-#elif defined(ICL_USE_STD_IMPLEMENTATION) +-# include +-#else +-# include +-#endif ++#include ICL_IMPL_PATH(set) + + #include + #include diff --git a/bazel/boost-icl-patches/BUILD.bazel b/bazel/boost-icl-patches/BUILD.bazel new file mode 100644 index 00000000000..d518110449e --- /dev/null +++ b/bazel/boost-icl-patches/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.patch"])) diff --git a/bazel/bzl_lint_test.sh b/bazel/bzl_lint_test.sh index 72d20002e08..02d1cb999bc 100755 --- a/bazel/bzl_lint_test.sh +++ b/bazel/bzl_lint_test.sh @@ -9,6 +9,15 @@ set -euo pipefail TOOL="$(realpath "$1")" GIT="$(realpath "$2")" +# With rules_python's script bootstrap (bootstrap_impl=script), a py_binary +# invoked via its realpath cannot locate its runfiles once we cd away. +# Export the runfiles root (the .runfiles directory) so nested tools +# resolve it from the environment instead. We start in the workspace +# subdirectory of it (.runfiles/); strip the last path +# component rather than a hardcoded workspace name so this also holds when +# the workspace is not "_main" (e.g. consumed as a dependency). +export RUNFILES_DIR="${RUNFILES_DIR:-${PWD%/*}}" + # MODULE.bazel must be in the sh_test `data` deps so it appears as a # runfiles symlink pointing at the real workspace. `readlink` (no -f, # for macOS portability) resolves the absolute path Bazel wrote. diff --git a/bazel/tcl-patches/0001-tclZipfs-include-vendored-minizip-crypt.h-by-path.patch b/bazel/tcl-patches/0001-tclZipfs-include-vendored-minizip-crypt.h-by-path.patch new file mode 100644 index 00000000000..11bf1388c8b --- /dev/null +++ b/bazel/tcl-patches/0001-tclZipfs-include-vendored-minizip-crypt.h-by-path.patch @@ -0,0 +1,20 @@ +tclZipfs.c includes the vendored minizip crypt.h as #include "crypt.h", +relying on compat/zlib/contrib/minizip preceding any system directory +that also has a crypt.h. Hermetic toolchains that provide glibc headers +as explicit -isystem directories (e.g. the hermetic-llvm cc_toolchain) +search glibc's crypt.h (Unix password hashing) first, and the build +fails with implicit declarations of init_keys/decrypt_byte/zencode. +Include the intended header by its unambiguous path relative to the +compat/zlib include root instead. + +--- a/generic/tclZipfs.c ++++ b/generic/tclZipfs.c +@@ -75,7 +75,7 @@ + } while (0) + + #include "zlib.h" +-#include "crypt.h" ++#include "contrib/minizip/crypt.h" + #include "zutil.h" + #include "crc32.h" + diff --git a/bazel/tcl-patches/BUILD.bazel b/bazel/tcl-patches/BUILD.bazel new file mode 100644 index 00000000000..d518110449e --- /dev/null +++ b/bazel/tcl-patches/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.patch"])) diff --git a/bazel/tcl_lint_test.sh b/bazel/tcl_lint_test.sh index 98b88b77a1f..a155b413af4 100755 --- a/bazel/tcl_lint_test.sh +++ b/bazel/tcl_lint_test.sh @@ -9,6 +9,15 @@ set -euo pipefail TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" GIT="$(realpath "$2")" +# With rules_python's script bootstrap (bootstrap_impl=script), a py_binary +# invoked via its realpath cannot locate its runfiles once we cd away. +# Export the runfiles root (the .runfiles directory) so nested tools +# resolve it from the environment instead. We start in the workspace +# subdirectory of it (.runfiles/); strip the last path +# component rather than a hardcoded workspace name so this also holds when +# the workspace is not "_main" (e.g. consumed as a dependency). +export RUNFILES_DIR="${RUNFILES_DIR:-${PWD%/*}}" + WORKSPACE="$(dirname "$(readlink -f tclint.toml)")" cd "$WORKSPACE" diff --git a/docs/agents/ci.md b/docs/agents/ci.md index 8b9b48f1f37..f02062daada 100644 --- a/docs/agents/ci.md +++ b/docs/agents/ci.md @@ -23,7 +23,7 @@ bazel build --config=lint //src/utl/... # Full lint scope (excludes submodules): bazel build --config=lint -- //src/... //third-party/... -//src/sta/... -//third-party/abc/... ``` -- Uses `clang-tidy` from `@llvm_toolchain` (the same binary `etc/run-clang-tidy.sh` uses). +- Uses `clang-tidy` from `@llvm//tools` (the same binary `etc/run-clang-tidy.sh` uses). - Reports land at `$(bazel info bazel-bin)//_rules_lint/.AspectRulesLintClangTidy.out`. - Generated files (SWIG, bison, flex) are auto-skipped. Targets tagged `no-lint` are skipped. - Aspect + config defined in `tools/lint/` and `//:.bazelrc` (`--config=lint`). diff --git a/docs/user/Bazel.md b/docs/user/Bazel.md index d00df167f74..964068a359b 100644 --- a/docs/user/Bazel.md +++ b/docs/user/Bazel.md @@ -108,18 +108,18 @@ git_override( ### Suggested: pin the C++ toolchain for reproducibility -OpenROAD uses `toolchains_llvm` internally to lock the compiler version -and ensure reproducible builds across developers and CI. Downstream -consumers can use any C++20-capable compiler, but pinning the same -toolchain is recommended to avoid compiler-specific issues: +OpenROAD uses [hermetic-llvm](https://github.com/hermeticbuild/hermetic-llvm) +(BCR module `llvm`) internally to lock the compiler version and ensure +reproducible builds across developers and CI: statically linked LLVM +binaries and a zero-sysroot cc_toolchain, so no host compiler, headers +or libraries are involved. Downstream consumers can use any +C++20-capable compiler, but pinning the same toolchain is recommended +to avoid compiler-specific issues: ```starlark -bazel_dep(name = "toolchains_llvm", version = "1.5.0") +bazel_dep(name = "llvm", version = "0.8.11") -llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") -llvm.toolchain(llvm_version = "20.1.8") -use_repo(llvm, "llvm_toolchain") -register_toolchains("@llvm_toolchain//:all") +register_toolchains("@llvm//toolchain:all") ``` ### Dev dependencies not leaked to consumers @@ -129,7 +129,7 @@ on downstream projects via MVS: - rules_pkg — only needed for //:install - `rules_verilator`, `verilator` — only needed for test/orfs simulation -- `toolchains_llvm` extension and toolchain registration +- `llvm` (hermetic-llvm) toolchain registration The downstream test at `test/downstream/` verifies these invariants. diff --git a/etc/bazel-hermetic b/etc/bazel-hermetic new file mode 100755 index 00000000000..73a995de5a4 --- /dev/null +++ b/etc/bazel-hermetic @@ -0,0 +1,242 @@ +#!/usr/bin/env bash +# LOCAL DEVELOPER DIAGNOSTIC — opt-in, not part of the normal build. +# Nothing auto-invokes this; you never need it to build or test OpenROAD. +# (Authored with Claude to catch host-toolchain leaks during the +# hermetic-llvm bring-up.) +# +# It launches bazel in a pruned environment so that toolchains and tools +# the build is supposed to provide hermetically cannot be picked up from +# the host. This is a ratchet, not a proof: it removes host compilers, +# linkers and interpreters from PATH. The C++ toolchain (hermetic-llvm) +# is zero-sysroot, so no host headers or libraries are involved; the +# remaining host surface is the bazel binary itself and the allowlisted +# shell tools below. +# +# Invoke it explicitly when you want the check: +# etc/bazel-hermetic [startup flags] [args...] +# Deliberately named etc/bazel-hermetic, NOT tools/bazel: bazelisk +# auto-invokes a tools/bazel wrapper for every command, which would force +# the pruned environment on everyone — but repository rules of some +# dependencies legitimately expect host tools this wrapper prunes (e.g. +# GNU Make's configure probing for ld in bazel-orfs's gnumake rule), so +# forcing it would break ordinary builds. Keeping it opt-in and +# out-of-the-way is intentional. +# +# The allowlist below is the contract for what the build may use from the +# host. Grow it only with a comment stating which repository rule or +# action needs the entry and why bazel cannot provide it. +set -euo pipefail + +# Base shell utilities: repository rules (patch_cmds, configure scripts of +# module extensions) run through /bin/sh and expect a POSIX userland. +ALLOWED_TOOLS=( + bash sh env + basename dirname readlink realpath pwd + cat cp ln ls mkdir mktemp mv rm rmdir touch chmod stat find + cut grep head sed sort tail tr uniq wc od printf true false test expr sleep + awk # module extension configure steps + diff cmp patch # single_version_override / archive_override patches + tar gzip bzip2 xz zstd unzip # archive extraction fallbacks + tee file xargs # base utilities used by module extension scripts + uname id hostname date which getconf nproc + git # tools/workspace_status.sh embeds version info + gh # optional; used by some developer workflows +) + +# A fixed per-checkout toolbox: its path feeds --repo_env=PATH below, +# which is part of bazel's analysis cache key, so it must be +# byte-identical across runs — a random mktemp path forced a full +# re-analysis and repository refetch on every invocation. It lives under +# the workspace tmp/ (gitignored): per-user and per-checkout by +# construction (no /tmp cross-user collisions) and not on a RAM-backed +# tmpfs as /tmp commonly is. +ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) +TOOLBOX="${ROOT}/tmp/bazel-toolbox" +mkdir -p "${TOOLBOX}" + +# Entries not in the allowlist (edited allowlist, older wrapper) are +# pruned so the toolbox never offers more than the contract above. +for entry in "${TOOLBOX}"/*; do + [[ -e ${entry} || -L ${entry} ]] || continue + name=$(basename "${entry}") + keep=0 + [[ ${name} == bazel ]] && keep=1 + for tool in "${ALLOWED_TOOLS[@]}"; do + [[ ${name} == "${tool}" ]] && { keep=1; break; } + done + [[ ${keep} -eq 1 ]] || rm -f "${entry}" +done + +# type -P forces a PATH search: command -v would return bare builtin names +# (pwd, test, true, ...) and create self-referential symlinks. ln -sfn +# replaces atomically, so a concurrent invocation never sees a missing +# tool; a tool that vanished from the host PATH is dropped. +for tool in "${ALLOWED_TOOLS[@]}"; do + if path=$(type -P -- "${tool}" 2>/dev/null); then + ln -sfn "${path}" "${TOOLBOX}/${tool}" 2>/dev/null || true + else + rm -f "${TOOLBOX}/${tool}" + fi +done + +# The bazel binary itself. When bazelisk invokes this wrapper it hands us +# the real binary in $BAZEL_REAL. Otherwise resolve it: bazelisk is often +# a node or shell wrapper whose interpreter must not leak into the pruned +# PATH, so find the real binary it manages (~/.cache/bazelisk) instead of +# symlinking the wrapper. +BAZEL=${BAZEL_REAL:-} +if [[ -z ${BAZEL} ]]; then + BAZEL=$(command -v bazelisk || command -v bazel) || + { echo >&2 "etc/bazel-hermetic: no bazel or bazelisk on PATH"; exit 1; } +fi +# Wrapper detection: the bazelisk launcher by name, or any script shebang +# (npm/shell wrappers). Native binaries (ELF on Linux, Mach-O on macOS) +# are symlinked directly. Read the first two bytes with the `read` +# builtin (no head subprocess); the redirection's open() follows the +# symlink for us, so no realpath/readlink -f is needed either. +sig="" +read -r -n 2 sig < "${BAZEL}" 2>/dev/null || true +if [[ ${BAZEL} == *bazelisk* || ${sig} == '#!' ]]; then + version=$(BAZELISK_SKIP_WRAPPER=1 "${BAZEL}" --version | awk '{print $2}') + os=$(uname -s | tr '[:upper:]' '[:lower:]') + arch=$(uname -m | sed 's/aarch64/arm64/') + # Same cache-directory precedence as bazelisk itself. + if [[ -n ${BAZELISK_HOME:-} ]]; then + bazelisk_home=${BAZELISK_HOME} + elif [[ -n ${XDG_CACHE_HOME:-} ]]; then + bazelisk_home=${XDG_CACHE_HOME}/bazelisk + elif [[ ${os} == darwin ]]; then + bazelisk_home=${HOME}/Library/Caches/bazelisk + else + bazelisk_home=${HOME}/.cache/bazelisk + fi + meta="${bazelisk_home}/downloads/metadata/bazelbuild/bazel-${version}-${os}-${arch}" + # || true: a missing metadata file (non-bazelisk wrapper) must fall + # through to the check below, not abort the assignment under set -e. + real="${bazelisk_home}/downloads/sha256/$(cat "${meta}" 2>/dev/null || true)/bin/bazel" + if [[ -x ${real} ]]; then + BAZEL=${real} + else + # A wrapper we can't resolve to a bazelisk-managed binary — e.g. a + # custom (non-bazelisk) bazel wrapper. Use it directly rather than + # refusing to run: if its interpreter isn't on the pruned PATH the + # launch fails loudly on its own, which is better than blocking every + # non-bazelisk wrapper up front. + echo >&2 "etc/bazel-hermetic: ${BAZEL} looks like a wrapper but no" \ + "bazelisk-managed bazel-${version} was found under" \ + "${bazelisk_home}; using it directly" + fi +fi +ln -sfn "${BAZEL}" "${TOOLBOX}/bazel" + +# Leading --flags are bazel startup options (e.g. --output_base=...). +# A flags-only invocation (e.g. `bazel --version`) is valid: no command. +startup_flags=() +while [[ $# -gt 0 && $1 == --* ]]; do + startup_flags+=("$1") + shift +done +command=${1:-} +[[ $# -gt 0 ]] && shift + +# Classify the command. The set is exhaustive on purpose: a bazel startup +# option can take its value as a separate word (`--output_base /tmp/x`), +# and the loop above stops at the first non---flag, so that value would be +# mistaken for the command. If we silently treated an unrecognized token +# as a no-repo_env command, a build invoked that way would run repository +# rules with the unpruned host PATH — exactly the leak this tool exists to +# catch. So fail loud instead: an unknown command is an error, not a +# silent bypass. +extra_flags=() +case "${command}" in + build|test|run|cquery|aquery|coverage|fetch|vendor|sync|mod) + extra_flags=( + # Repository rules see only the allowlisted tools. Actions keep + # bazel's strict default PATH (/bin:/usr/bin): the test harness + # still uses host python3/tee/file (see the PR cleanup list), and + # an --action_env PATH carrying this checkout-specific directory + # would fragment action cache keys across machines. + # BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN lives in .bazelrc so it + # applies to unwrapped invocations too. + "--repo_env=PATH=${TOOLBOX}" + ) + ;; + # Commands that never fetch/analyze external repositories: no pruning + # needed, pass through untouched. + query|info|clean|version|help|shutdown|dump|license|\ + canonicalize-flags|print_action|analyze-profile|config|mobile-install) + ;; + '') + # Flags-only invocation (e.g. `--version`); handled below. + ;; + *) + echo >&2 "etc/bazel-hermetic: unrecognized command '${command}'." + echo >&2 "If this was a startup option value, join it to the flag" \ + "(--flag=value, one word) so the command is parsed correctly" \ + "and the hermetic PATH is not silently bypassed." + exit 1 + ;; +esac + +# Network, auth, TLS and cache/tmp configuration is not toolchain leakage: +# downloads must work behind corporate proxies, custom CAs, and git-over-ssh +# overrides, and users may relocate caches and tmp. The BAZELISK_* / token +# vars matter when the resolved bazel is a bazelisk wrapper used directly +# (custom cache location, enterprise mirror, GitHub rate limits). The cloud +# credential vars keep remote cache/execution auth (GCS, S3) working under +# env -i. +preserved_env=() +for var in http_proxy https_proxy no_proxy HTTP_PROXY HTTPS_PROXY NO_PROXY \ + SSH_AUTH_SOCK SSL_CERT_FILE SSL_CERT_DIR XDG_CACHE_HOME TMPDIR \ + DISPLAY WAYLAND_DISPLAY XAUTHORITY \ + BAZELISK_HOME BAZELISK_BASE_URL BAZELISK_GITHUB_TOKEN GITHUB_TOKEN \ + GOOGLE_APPLICATION_CREDENTIALS \ + AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \ + AWS_ROLE_ARN AWS_WEB_IDENTITY_TOKEN_FILE AWS_SHARED_CREDENTIALS_FILE \ + AWS_PROFILE AWS_CONFIG_FILE AWS_DEFAULT_REGION AWS_REGION; do + # Pure-bash indirect lookup, no subprocess and no eval: ${!var+x} tests + # whether the variable named by $var is set (set -u-safe), then ${!var} + # reads its value. + if [[ -n ${!var+x} ]]; then + value=${!var} + if [[ -n ${value} ]]; then + preserved_env+=("${var}=${value}") + fi + fi +done + +# --nosystem_rc/--nohome_rc: only the workspace .bazelrc applies, so host- +# specific configuration (e.g. remote caches) cannot mask missing hermeticity. +# ${arr[@]+"${arr[@]}"} expands to nothing when the array is empty: a bare +# "${arr[@]}" is an unbound-variable error under set -u on bash < 4.4 (the +# 3.2 that macOS ships as /bin/bash). +bazel_argv=(--nosystem_rc --nohome_rc ${startup_flags[@]+"${startup_flags[@]}"}) +if [[ -n ${command} ]]; then + bazel_argv+=("${command}" ${extra_flags[@]+"${extra_flags[@]}"} "$@") +fi +# Flags-only invocations (e.g. `bazel --version`) go to the binary verbatim; +# rc-file options would be rejected there. +if [[ -z ${command} ]]; then + bazel_argv=(${startup_flags[@]+"${startup_flags[@]}"}) +fi + +# macOS has no C.UTF-8 locale, so forcing it there makes programs print +# "cannot change locale" warnings; use en_US.UTF-8 on Darwin. Both give +# UTF-8 byte handling. +case "$(uname -s)" in + Darwin) lang=en_US.UTF-8 ;; + *) lang=C.UTF-8 ;; +esac + +# HOME:? fails early with a clear message if HOME is unset/empty (bazel +# needs it for its caches and user bazelrc) instead of silently passing +# an empty HOME; the array guards give the set -u / bash 3.2 safety. +exec env -i \ + HOME="${HOME:?etc/bazel-hermetic: HOME must be set}" \ + USER="${USER:-$(id -un 2>/dev/null || echo nobody)}" \ + LOGNAME="${LOGNAME:-$(id -un 2>/dev/null || echo nobody)}" \ + TERM="${TERM:-dumb}" \ + LANG="${lang}" \ + PATH="${TOOLBOX}" \ + ${preserved_env[@]+"${preserved_env[@]}"} \ + "${TOOLBOX}/bazel" ${bazel_argv[@]+"${bazel_argv[@]}"} diff --git a/etc/run-clang-tidy.sh b/etc/run-clang-tidy.sh index e66495f2275..b1da327ce3a 100755 --- a/etc/run-clang-tidy.sh +++ b/etc/run-clang-tidy.sh @@ -24,7 +24,7 @@ fi # Use either CLANG_TIDY provided by the user as environment variable or use # our own from the toolchain we configured in the MODULE.bazel -export CLANG_TIDY="${CLANG_TIDY:-$("${BAZEL}" run -c opt --run_under='echo' @llvm_toolchain//:clang-tidy 2>/dev/null)}" +export CLANG_TIDY="${CLANG_TIDY:-$("${BAZEL}" run -c opt --run_under='echo' @llvm//tools:clang-tidy 2>/dev/null)}" # The user should keep the compilation DB fresh, but refresh here # if substantial things changed or it is not there in the first place. diff --git a/test/downstream/MODULE.bazel b/test/downstream/MODULE.bazel index 5b5612a9916..bff693b9ea4 100644 --- a/test/downstream/MODULE.bazel +++ b/test/downstream/MODULE.bazel @@ -20,20 +20,59 @@ git_override( remote = "https://github.com/The-OpenROAD-Project/qt_bazel_prebuilts", ) -# toolchains_llvm is dev_dependency in OpenROAD, so the root module must -# configure the C++ toolchain. -bazel_dep(name = "toolchains_llvm", version = "1.5.0") - -llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm") -llvm.toolchain( - llvm_version = "20.1.8", -) -use_repo(llvm, "llvm_toolchain") +# The C++ toolchain is a dev_dependency in OpenROAD, so the root module +# must configure its own. hermetic-llvm provides a statically linked, +# zero-sysroot LLVM toolchain. +bazel_dep(name = "llvm", version = "0.8.11") register_toolchains( - "@llvm_toolchain//:all", + "@llvm//toolchain:all", ) +# hermetic-llvm ships a minimal macOS SDK subset (frameworks are opt-in). +# The root MODULE.bazel selects the desktop frameworks Qt needs, but it does +# so on a dev_dependency extension, which does not apply when OpenROAD is +# consumed as a dependency -- so a downstream macOS consumer building the Qt +# GUI must repeat the selection here, just like the qt-bazel git_override +# above. Keep this list in sync with osx.frameworks(...) in ../../MODULE.bazel. +osx = use_extension("@llvm//extensions:osx.bzl", "osx") +osx.frameworks(names = [ + "CoreFoundation", + "Foundation", + "Kernel", + "OSLog", + "Security", + "SystemConfiguration", + "AppKit", + "ApplicationServices", + "CFNetwork", + "Carbon", + "Cocoa", + "ColorSync", + "CoreData", + "CoreGraphics", + "CoreImage", + "CoreServices", + "CoreText", + "CoreVideo", + "DiskArbitration", + "FontServices", + "GSS", + "IOKit", + "IOSurface", + "ImageIO", + "Metal", + "MetalKit", + "ModelIO", + "OpenGL", + "PrintCore", + "QuartzCore", + "CloudKit", + "Symbols", + "UIFoundation", + "UniformTypeIdentifiers", +]) + python = use_extension("@rules_python//python/extensions:python.bzl", "python") python.toolchain( ignore_root_user_error = True, diff --git a/tools/lint/BUILD.bazel b/tools/lint/BUILD.bazel index fe4f479de21..25d6efe8799 100644 --- a/tools/lint/BUILD.bazel +++ b/tools/lint/BUILD.bazel @@ -7,6 +7,6 @@ package(default_visibility = ["//visibility:public"]) native_binary( name = "clang_tidy", - src = "@llvm_toolchain_llvm//:bin/clang-tidy", + src = "@llvm//tools:clang-tidy", out = "clang_tidy", )