Skip to content

Commit f58686f

Browse files
committed
Merge remote-tracking branch 'origin/master' into secure-rsz-time-borrow-opt
Signed-off-by: Jaehyun Kim <jhkim@precisioninno.com>
2 parents 5828961 + e823004 commit f58686f

92 files changed

Lines changed: 32833 additions & 276 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,13 @@ common --enable_platform_specific_config
9696
# macOS: boost.stacktrace needs this since backtrace() doesn't require GNU source
9797
build:macos --copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
9898
build:macos --host_copt=-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
99-
# Aligned allocation/deallocation for abseil is only available since 10.13
100-
build:macos --macos_minimum_os=10.13
101-
build:macos --host_macos_minimum_os=10.13
99+
# Floating-point std::to_chars (behind std::format, used by OpenSTA)
100+
# needs macOS 13.3; std::filesystem (src/tcl_readline_setup.cc) needs
101+
# 10.15; abseil's aligned allocation needs 10.13. The historical 10.13
102+
# floor was never enforced: toolchains_llvm ignored it and compiled
103+
# against the host SDK's default. hermetic-llvm honors it.
104+
build:macos --macos_minimum_os=13.3
105+
build:macos --host_macos_minimum_os=13.3
102106

103107
# Settings for --config=asan address sanitizer build
104108
build:asan --strip=never
@@ -123,6 +127,9 @@ build:profile --copt -fno-omit-frame-pointer --host_copt -fno-omit-frame-pointer
123127
# Improve hermeticity by disallowing user envars and network access
124128
build --incompatible_strict_action_env
125129
build --nosandbox_default_allow_network
130+
# Refuse to autodetect a local C++ toolchain (/usr/bin/gcc); the hermetic
131+
# toolchain must win resolution, with or without the etc/bazel-hermetic wrapper.
132+
common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
126133

127134
test --build_tests_only
128135

@@ -142,6 +149,11 @@ build:ci --disk_cache=
142149
# Tell the 'ci' config to include 'opt'
143150
build:ci --config=opt
144151

152+
# Launch py_binary via a shell stub instead of rules_python's legacy python
153+
# stub, whose '#!/usr/bin/env python3' shebang needs a host python3 before
154+
# the hermetic interpreter takes over (found by etc/bazel-hermetic).
155+
common --@rules_python//python/config_settings:bootstrap_impl=script
156+
145157
# Setup remote cache
146158
# Anon: HTTPS read-only cache
147159
build --remote_cache=https://bazel.precisioninno.com

BUILD.bazel

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,14 @@ sh_test(
584584
sh_binary(
585585
name = "tidy_tcl",
586586
srcs = ["//bazel:tcl_tidy.sh"],
587-
args = ["$(rootpath //bazel:tclfmt)"],
587+
args = [
588+
"$(rootpath //bazel:tclfmt)",
589+
"$(rootpath @git)",
590+
],
588591
data = [
589592
"tclint.toml",
590593
"//bazel:tclfmt",
594+
"@git",
591595
],
592596
)
593597

@@ -633,9 +637,13 @@ sh_test(
633637
sh_binary(
634638
name = "tidy_bzl",
635639
srcs = ["//bazel:bzl_tidy.sh"],
636-
args = ["$(rootpath @buildifier_prebuilt//:buildifier)"],
640+
args = [
641+
"$(rootpath @buildifier_prebuilt//:buildifier)",
642+
"$(rootpath @git)",
643+
],
637644
data = [
638645
"@buildifier_prebuilt//:buildifier",
646+
"@git",
639647
],
640648
)
641649

@@ -666,6 +674,7 @@ sh_binary(
666674
"$(rootpath @buildifier_prebuilt//:buildifier)",
667675
"$(rootpath //bazel:bzl_lint_test.sh)",
668676
"$(rootpath @buildifier_prebuilt//:buildifier)",
677+
"$(rootpath @git)",
669678
],
670679
data = [
671680
"MODULE.bazel",
@@ -677,5 +686,6 @@ sh_binary(
677686
"//bazel:tclfmt",
678687
"//bazel:tclint",
679688
"@buildifier_prebuilt//:buildifier",
689+
"@git",
680690
],
681691
)

MODULE.bazel

Lines changed: 133 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,35 @@ bazel_dep(name = "rules_python", version = "1.8.5")
3434
bazel_dep(name = "rules_shell", version = "0.6.1")
3535
bazel_dep(name = "swig", version = "4.3.0.bcr.2")
3636

37+
# bison is transitive (rules_bison -> bison). Same gnulib libc-header
38+
# shadowing class as sed/gawk/m4 under hermetic-llvm (BCR #7642).
39+
# 3.8.2.bcr.7 fixes lib/ but src/ still picks up raw libc headers; the
40+
# patch restores gnulib wrapper-header precedence via -I (to be proposed
41+
# upstream as 3.8.2.bcr.8, then drop).
42+
single_version_override(
43+
module_name = "bison",
44+
patch_strip = 1,
45+
patches = [
46+
"//bazel/bison-patches:0001-gnulib-wrapper-headers-use-I-not-isystem.patch",
47+
],
48+
version = "3.8.2.bcr.7",
49+
)
50+
3751
BOOST_VERSION = "1.89.0.bcr.2"
3852

53+
# boost::icl's exclusive_less_than comparator violates strict weak ordering
54+
# (boostorg/icl#51); libc++'s std::map exposes it, leaving phantom intervals
55+
# after interval_set subtraction (boostorg/icl#55) — pad IO fillers were
56+
# placed on top of pads. Upstream fix boostorg/icl@7de3f55655 (#54), merged
57+
# after boost 1.90. Drop when a boost.icl release containing it lands in BCR.
58+
single_version_override(
59+
module_name = "boost.icl",
60+
patch_strip = 1,
61+
patches = [
62+
"//bazel/boost-icl-patches:0001-refactor-interval-lookup-operations-icl-54.patch",
63+
],
64+
)
65+
3966
bazel_dep(name = "boost.algorithm", version = BOOST_VERSION)
4067
bazel_dep(name = "boost.asio", version = BOOST_VERSION)
4168
bazel_dep(name = "boost.beast", version = BOOST_VERSION)
@@ -76,13 +103,54 @@ bazel_dep(name = "boost.utility", version = BOOST_VERSION)
76103
bazel_dep(name = "cudd", version = "3.0.0.bcr.2")
77104
bazel_dep(name = "eigen", version = "3.4.0.bcr.3")
78105
bazel_dep(name = "fmt", version = "11.2.0.bcr.1")
106+
107+
# gawk is transitive (abc -> ncurses -> gawk; yosys -> gawk). Same gnulib
108+
# libc-header shadowing as sed: gawk@5.3.2.bcr.2 fails to compile against
109+
# hermetic-llvm's explicit libc -isystem entries (BCR #7642). 5.3.2.bcr.7
110+
# carries the upstream fix (BCR #7989).
111+
single_version_override(
112+
module_name = "gawk",
113+
version = "5.3.2.bcr.7",
114+
)
115+
79116
bazel_dep(name = "git", version = "2.54.0")
80117
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
118+
119+
# m4 is transitive (rules_bison/rules_flex -> m4). Same gnulib libc-header
120+
# shadowing class as sed/gawk under hermetic-llvm (BCR #7642).
121+
single_version_override(
122+
module_name = "m4",
123+
version = "1.4.21.bcr.4",
124+
)
125+
81126
bazel_dep(name = "openmp", version = "21.1.5.bcr.2")
82127
bazel_dep(name = "or-tools", version = "9.15")
128+
129+
# sed is transitive (abc -> ncurses -> sed). Its vendored gnulib headers
130+
# deliberately shadow libc headers (stdio.h, error.h); hermetic-llvm's
131+
# explicit libc -isystem entries outrank them and sed@4.9.bcr.3 fails to
132+
# compile (BCR #7642). 4.9.bcr.5 carries the upstream fix (BCR #7915).
133+
single_version_override(
134+
module_name = "sed",
135+
version = "4.9.bcr.5",
136+
)
137+
83138
bazel_dep(name = "spdlog", version = "1.15.1")
84139
bazel_dep(name = "sv-lang", version = "10.0.1-20260316-f04e8156")
85140
bazel_dep(name = "tcl_lang", version = "9.0.2.bcr.1")
141+
142+
# tclZipfs.c's '#include "crypt.h"' picks up glibc's crypt.h instead of the
143+
# vendored minizip one when glibc headers are explicit -isystem directories
144+
# (hermetic-llvm zero-sysroot toolchain). Drop when fixed in a tcl_lang
145+
# BCR release.
146+
single_version_override(
147+
module_name = "tcl_lang",
148+
patch_strip = 1,
149+
patches = [
150+
"//bazel/tcl-patches:0001-tclZipfs-include-vendored-minizip-crypt.h-by-path.patch",
151+
],
152+
)
153+
86154
bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
87155
bazel_dep(name = "yaml-cpp", version = "0.9.0")
88156
bazel_dep(name = "zlib", version = "1.3.1.bcr.8")
@@ -101,7 +169,12 @@ git_override(
101169

102170
## Lock the compiler version and avoid any local compiler.
103171
## Downstream consumers must configure their own C++ toolchain.
104-
bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True)
172+
##
173+
## hermetic-llvm (BCR module "llvm") provides statically linked LLVM
174+
## binaries and a zero-sysroot cc_toolchain: no host compiler, linker,
175+
## libxml2 or /usr/include involved, and it runs unmodified on distros
176+
## without FHS paths (e.g. NixOS).
177+
bazel_dep(name = "llvm", version = "0.8.11", dev_dependency = True)
105178

106179
# --- Dev dependencies (not propagated to downstream consumers) ---
107180

@@ -159,26 +232,72 @@ archive_override(
159232

160233
bazel_dep(name = "yosys", version = "0.62.bcr.2", dev_dependency = True)
161234
bazel_dep(name = "yosys-slang", version = "0.0.0", dev_dependency = True)
235+
archive_override(
236+
module_name = "yosys-slang",
237+
sha256 = "34198f2ed7b2d3175c3ce3c9fb1c6c91f28dbcfe531d97b91d6b12c48431bdef",
238+
strip_prefix = "sv-elab-6760afa2c9b9ba231a9c6a9e94f0939dd39f0a20",
239+
urls = ["https://github.com/povik/yosys-slang/archive/6760afa2c9b9ba231a9c6a9e94f0939dd39f0a20.tar.gz"],
240+
)
162241

163242
# --- Extensions ---
164243

165-
llvm = use_extension(
166-
"@toolchains_llvm//toolchain/extensions:llvm.bzl",
167-
"llvm",
168-
dev_dependency = True,
169-
)
170-
llvm.toolchain(
171-
llvm_version = "20.1.8",
172-
)
173-
use_repo(llvm, "llvm_toolchain", "llvm_toolchain_llvm")
174-
175-
# FYI: Comment out @llvm_toolchain//:all on NixOS and use the local clang toolchain instead.
176244
register_toolchains(
177-
"@llvm_toolchain//:all",
245+
"@llvm//toolchain:all",
178246
"@rules_verilator//verilator:verilator_toolchain",
179247
dev_dependency = True,
180248
)
181249

250+
# hermetic-llvm ships a minimal macOS SDK subset (frameworks are opt-in).
251+
# Qt (qt-bazel) needs the desktop frameworks; the first six entries are
252+
# hermetic-llvm's defaults, which listing any framework replaces.
253+
osx = use_extension("@llvm//extensions:osx.bzl", "osx", dev_dependency = True)
254+
osx.frameworks(names = [
255+
"CoreFoundation",
256+
"Foundation",
257+
"Kernel",
258+
"OSLog",
259+
"Security",
260+
"SystemConfiguration",
261+
"AppKit",
262+
"ApplicationServices",
263+
"CFNetwork",
264+
"Carbon",
265+
"Cocoa",
266+
"ColorSync",
267+
"CoreData",
268+
"CoreGraphics",
269+
"CoreImage",
270+
"CoreServices",
271+
"CoreText",
272+
"CoreVideo",
273+
"DiskArbitration",
274+
# ATS (inside the ApplicationServices umbrella) has .tbd symlinks into
275+
# the FontServices private framework; without it they dangle and bazel
276+
# rejects the sysroot ("file type is not supported").
277+
"FontServices",
278+
"GSS",
279+
"IOKit",
280+
"IOSurface",
281+
"ImageIO",
282+
"Metal",
283+
# MetalKit's MTKModel.h includes ModelIO/ModelIO.h.
284+
"MetalKit",
285+
"ModelIO",
286+
"OpenGL",
287+
# PrintCore is inside the ApplicationServices umbrella, but must be
288+
# named for the SDK subset to keep usr/include/cups (its ObjC headers
289+
# import <cups/ppd.h>).
290+
"PrintCore",
291+
"QuartzCore",
292+
# AppKit reaches these on macOS: NSImageView.h includes Symbols
293+
# unconditionally; NSText*.h take the non-UIKit branch into the
294+
# UIFoundation private framework; NSSharingService pulls CloudKit.
295+
"CloudKit",
296+
"Symbols",
297+
"UIFoundation",
298+
"UniformTypeIdentifiers",
299+
])
300+
182301
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
183302
python.toolchain(
184303
ignore_root_user_error = True,
@@ -244,7 +363,7 @@ alias(
244363
visibility = ["//visibility:public"],
245364
)
246365
""",
247-
path = "bazel",
366+
path = "bazel/slang-compat",
248367
)
249368

250369
# --- Overrides ---

0 commit comments

Comments
 (0)