Skip to content

Commit 6f986d8

Browse files
committed
Merge branch 'master' of github.com:The-OpenROAD-Project-private/OpenROAD
2 parents 9483c13 + b74c2ea commit 6f986d8

98 files changed

Lines changed: 14889 additions & 1897 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ build --copt "-Wextra" --host_copt "-Wextra"
4343
# ... and disable the warnings we're not interested in.
4444
build --copt "-Wno-sign-compare" --host_copt "-Wno-sign-compare"
4545
build --copt "-Wno-unused-parameter" --host_copt "-Wno-unused-parameter"
46+
# False positive under Bazel's parse_headers feature: it compiles each
47+
# declared header as a main TU, which makes clang treat #pragma once as
48+
# a no-op and emit -Wpragma-once-outside-header. Project convention is
49+
# #pragma once for all headers, so silence the warning project-wide.
50+
build --copt "-Wno-pragma-once-outside-header" --host_copt "-Wno-pragma-once-outside-header"
4651
build --copt "-Wno-gcc-compat" --host_copt "-Wno-gcc-compat"
4752
build --copt "-Wno-nullability-extension" --host_copt "-Wno-nullability-extension"
4853
build --copt "-Wno-deprecated-declarations" --host_copt "-Wno-deprecated-declarations"

.github/workflows/github-actions-on-label-create.yml

Lines changed: 41 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -101,43 +101,30 @@ jobs:
101101
python3 -m venv /tmp/codeowners-venv
102102
/tmp/codeowners-venv/bin/pip install --quiet pathspec
103103
/tmp/codeowners-venv/bin/python <<'PY'
104-
import base64, json, os, subprocess, sys, time
104+
import base64, json, os, subprocess, sys
105105
from pathspec import GitIgnoreSpec
106106
107107
pr = os.environ["PR"]
108108
upstream = os.environ["UPSTREAM"]
109109
110-
# GitHub computes PR mergeability asynchronously, so `mergeable` and
111-
# `merge_commit_sha` are often null on the first read after PR
112-
# creation. Poll until the background job finishes.
113-
attempts = 10
114-
delay = 3
115-
for attempt in range(1, attempts + 1):
116-
pr_json = subprocess.check_output(
117-
["gh", "api", f"repos/{upstream}/pulls/{pr}"], text=True)
118-
pr_data = json.loads(pr_json)
119-
if pr_data.get("mergeable") is not None \
120-
and pr_data.get("merge_commit_sha"):
121-
break
122-
print(f"Mergeability not yet computed "
123-
f"(attempt {attempt}/{attempts}); sleeping {delay}s")
124-
time.sleep(delay)
125-
else:
126-
raise RuntimeError(
127-
"PR merge commit SHA is unavailable after polling; refusing "
128-
"to request CODEOWNERS reviewers from an incomplete "
129-
"effective diff.")
110+
pr_json = subprocess.check_output(
111+
["gh", "api", f"repos/{upstream}/pulls/{pr}"], text=True)
112+
pr_data = json.loads(pr_json)
130113
131114
author = pr_data["user"]["login"]
132115
base_ref = pr_data["base"]["ref"]
133-
base_repo = pr_data["base"]["repo"]["full_name"]
134116
base_sha = pr_data["base"]["sha"]
135117
head_repo = pr_data["head"]["repo"]["full_name"]
136118
head_sha = pr_data["head"]["sha"]
137-
merge_sha = pr_data["merge_commit_sha"]
138119
139-
print(f"Computing effective PR merge diff: {base_repo}@{base_sha}.."
140-
f"{base_repo}@{merge_sha} (head {head_repo}@{head_sha})")
120+
# The compare endpoint accepts cross-fork heads as "{owner}:{sha}".
121+
upstream_owner = upstream.split("/", 1)[0]
122+
head_owner = head_repo.split("/", 1)[0]
123+
head_ref = (head_sha if head_owner == upstream_owner
124+
else f"{head_owner}:{head_sha}")
125+
126+
print(f"Computing PR diff: {upstream}@{base_sha}..."
127+
f"{head_repo}@{head_sha}")
141128
142129
# Authoritative CODEOWNERS is the one on the PR base branch.
143130
raw = subprocess.check_output(
@@ -154,42 +141,39 @@ jobs:
154141
pattern, *rule_owners = line.split()
155142
rules.append((GitIgnoreSpec.from_lines([pattern]), rule_owners))
156143
157-
def commit_tree(repo, sha):
158-
commit_json = subprocess.check_output(
159-
["gh", "api", f"repos/{repo}/git/commits/{sha}"],
160-
text=True)
161-
commit_data = json.loads(commit_json)
162-
tree_sha = commit_data["tree"]["sha"]
163-
tree_json = subprocess.check_output(
144+
# Use the three-dot compare (merge_base(base, head)...head). This is
145+
# what GitHub's "Files changed" tab shows and is a deterministic
146+
# function of the two SHAs, so it does not race with master moving.
147+
# Previously we diffed base.sha against merge_commit_sha, but the
148+
# async-computed merge_commit_sha can lag behind base.sha, making
149+
# files only touched on master after the PR was opened appear as
150+
# PR-introduced changes and falsely route their CODEOWNERS teams.
151+
files = []
152+
page = 1
153+
per_page = 100
154+
while True:
155+
cmp_json = subprocess.check_output(
164156
["gh", "api",
165-
f"repos/{repo}/git/trees/{tree_sha}?recursive=1"],
166-
text=True)
167-
tree_data = json.loads(tree_json)
168-
if tree_data.get("truncated"):
157+
f"repos/{upstream}/compare/{base_sha}...{head_ref}"
158+
f"?per_page={per_page}&page={page}"], text=True)
159+
cmp_data = json.loads(cmp_json)
160+
page_files = cmp_data.get("files") or []
161+
for f in page_files:
162+
files.append(f["filename"])
163+
# Renames carry the source in previous_filename; route to
164+
# CODEOWNERS for both the old and new paths so moves out of
165+
# an owned directory still notify the original owner.
166+
if f.get("previous_filename"):
167+
files.append(f["previous_filename"])
168+
if len(page_files) < per_page:
169+
break
170+
page += 1
171+
if page > 30:
169172
raise RuntimeError(
170-
f"Recursive tree for {repo}@{sha} was truncated; "
173+
"PR comparison exceeded pagination cap (>3000 files); "
171174
"refusing to request partial CODEOWNERS reviewers.")
172175
173-
entries = {}
174-
for entry in tree_data["tree"]:
175-
if entry["type"] == "tree":
176-
continue
177-
entries[entry["path"]] = (
178-
entry.get("sha"), entry.get("mode"), entry.get("type"))
179-
return entries
180-
181-
# Use the effective merge-result delta rather than GitHub's PR file
182-
# list or a direct base -> head tree comparison. The PR file list is
183-
# merge-base based, so it can include already-landed upstream changes
184-
# brought in by a merge from the base branch. A direct base -> head
185-
# comparison has the opposite problem when the PR branch is behind the
186-
# base branch: it reports base-only changes as if the PR changed them.
187-
# Comparing base -> test-merge tree matches the content that would land
188-
# if this PR merged now, including real conflict-resolution edits.
189-
base_tree = commit_tree(base_repo, base_sha)
190-
merge_tree = commit_tree(base_repo, merge_sha)
191-
files = sorted(path for path in set(base_tree) | set(merge_tree)
192-
if base_tree.get(path) != merge_tree.get(path))
176+
files = sorted(set(files))
193177
194178
print("Effective changed files:")
195179
for path in files:

BUILD.bazel

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,27 @@ OPENROAD_DEFINES = [
166166
"ABC_NAMESPACE=abc",
167167
]
168168

169+
cc_library(
170+
name = "cli_completer",
171+
srcs = ["src/cli_completer.cc"],
172+
hdrs = ["src/cli_completer.h"],
173+
includes = ["src"],
174+
visibility = ["//visibility:public"],
175+
deps = [
176+
"@tcl_lang//:tcl",
177+
],
178+
)
179+
169180
cc_library(
170181
name = "tcl_readline_setup",
171182
srcs = ["src/tcl_readline_setup.cc"],
172183
hdrs = ["src/tcl_readline_setup.h"],
173184
includes = ["src"],
174185
visibility = ["//src/sta:__pkg__"],
175186
deps = [
187+
":cli_completer",
188+
"//third-party/linenoise",
176189
"@tcl_lang//:tcl",
177-
# tclreadline: provides ENABLE_READLINE define + links libtclreadline.
178-
# On systems without tclreadline these are empty stub targets (no-op).
179-
# See: https://github.com/The-OpenROAD-Project/OpenROAD/issues/7115
180-
"@tclreadline",
181-
"@tclreadline//:tclreadline_defs",
182190
],
183191
)
184192

@@ -206,6 +214,7 @@ cc_binary(
206214
"//src/sta:opensta_lib",
207215
"//src/utl",
208216
"//src/web",
217+
"@abseil-cpp//absl/base:no_destructor",
209218
"@boost.stacktrace",
210219
"@rules_cc//cc/runfiles", # sets BAZEL_CURRENT_REPOSITORY
211220
"@tcl_lang//:tcl",

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ option(TSAN "Enable Thread Sanitizer" OFF)
6060
option(UBSAN "Enable Undefined Behavior Sanitizer" OFF)
6161

6262
project(OpenROAD VERSION 1
63-
LANGUAGES CXX
63+
LANGUAGES C CXX
6464
)
6565

6666
set(OPENROAD_HOME ${PROJECT_SOURCE_DIR})
@@ -136,6 +136,16 @@ if(EXISTS "/etc/os-release")
136136
if(OS_ID STREQUAL "rocky" AND OS_VERSION_ID MATCHES "^8")
137137
set(LTO_UNSUPPORTED_OS TRUE)
138138
message(STATUS "Detected unsupported OS (${OS_ID} ${OS_VERSION_ID}): LTO will be disabled due to known build issues")
139+
# Rocky 8 ships gcc 8 in /usr/lib64/libstdc++.so.6. gcc-toolset-13's
140+
# `-lstdc++` resolves through a linker script that pulls
141+
# libstdc++_nonshared.a (fill-in for <filesystem> etc.). When that
142+
# archive's TUs (e.g. fs_path80.o) are pulled into a link with many
143+
# OpenROAD .a/.so inputs, the order/visibility of the system
144+
# libstdc++.so.6 ends up such that ld can't resolve internal helpers
145+
# like basic_string::resize and _Sp_counted_*. Statically link
146+
# libstdc++/libgcc to sidestep the fill-in archive entirely.
147+
add_link_options(-static-libstdc++ -static-libgcc)
148+
message(STATUS "Rocky 8: enabling -static-libstdc++ -static-libgcc to avoid libstdc++_nonshared.a link errors")
139149
endif()
140150
endif()
141151

MODULE.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ bazel_dep(name = "openmp", version = "21.1.5.bcr.1")
6666
bazel_dep(name = "or-tools", version = "9.15")
6767
bazel_dep(name = "spdlog", version = "1.15.1")
6868
bazel_dep(name = "tcl_lang", version = "9.0.2.bcr.1")
69-
bazel_dep(name = "tclreadline", version = "2.4.1")
7069
bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
7170
bazel_dep(name = "yaml-cpp", version = "0.9.0")
7271
bazel_dep(name = "zlib", version = "1.3.1.bcr.8")
@@ -90,7 +89,7 @@ bazel_dep(name = "toolchains_llvm", version = "1.5.0", dev_dependency = True)
9089
# --- Dev dependencies (not propagated to downstream consumers) ---
9190

9291
bazel_dep(name = "aspect_rules_lint", version = "2.5.2", dev_dependency = True)
93-
bazel_dep(name = "bant", version = "0.2.8", dev_dependency = True)
92+
bazel_dep(name = "bant", version = "0.2.9", dev_dependency = True)
9493
bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.2", dev_dependency = True)
9594
bazel_dep(name = "rules_verilator", version = "0.1.0", dev_dependency = True)
9695
bazel_dep(name = "verilator", version = "5.036.bcr.3", dev_dependency = True)

MODULE.bazel.lock

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/BUILD

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,12 @@ pkg_files(
4949
strip_prefix = strip_prefix.from_root(),
5050
)
5151

52-
pkg_files(
53-
name = "tclreadline_files",
54-
srcs = ["@tclreadline//:tclreadline_scripts"],
55-
prefix = "tclreadline",
56-
strip_prefix = strip_prefix.from_root(),
57-
)
58-
5952
# Packaging up all tcl resources to one complete zip file. It can be
6053
# directly embedded in Tcl9 in a //zipfs:/ vfs.
6154
pkg_zip(
6255
name = "tcl_resources_zip",
6356
srcs = [
6457
":tcl_core_files",
65-
":tclreadline_files",
6658
],
6759
)
6860

bazel/tcl_library_init.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ int SetupTclEnvironment(Tcl_Interp* interp)
3939
return TCL_ERROR;
4040
}
4141

42-
// Readline library location
43-
const std::string rd_lib = *mount_point + "/tclreadline";
44-
Tcl_Eval(interp, "namespace eval ::tclreadline {}");
45-
if (!Tcl_SetVar(
46-
interp, "::tclreadline::library", rd_lib.c_str(), TCL_GLOBAL_ONLY)) {
47-
std::cerr << "[Warning] could not set ::tclreadline::library\n";
48-
return TCL_ERROR;
49-
}
50-
5142
return TCL_OK;
5243
}
5344
} // namespace in_bazel

etc/DependencyInstaller.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,8 @@ _install_ubuntu_packages() {
981981
_execute "Installing base packages..." apt-get -y install --no-install-recommends \
982982
automake autotools-dev binutils bison build-essential ccache clang \
983983
debhelper devscripts flex g++ gcc git groff lcov libbz2-dev libffi-dev libfl-dev \
984-
libgomp1 libomp-dev libpcre2-dev libreadline-dev pandoc \
985-
pkg-config python3-dev qt5-image-formats-plugins tcl tcl-dev tcl-tclreadline \
984+
libgomp1 libomp-dev libpcre2-dev pandoc \
985+
pkg-config python3-dev qt5-image-formats-plugins tcl tcl-dev \
986986
tcllib unzip wget libyaml-cpp-dev zlib1g-dev tzdata
987987

988988
local packages=()
@@ -1025,8 +1025,8 @@ _install_rhel_packages() {
10251025
bzip2-devel libffi-devel libtool llvm llvm-devel llvm-libs make \
10261026
pcre2-devel pkg-config pkgconf pkgconf-m4 pkgconf-pkg-config python3 \
10271027
python3-devel python3-pip qt5-qtbase-devel qt5-qtcharts-devel \
1028-
qt5-qtimageformats readline tcl-devel tcl-tclreadline \
1029-
tcl-tclreadline-devel tcl-thread-devel tcllib wget yaml-cpp-devel \
1028+
qt5-qtimageformats tcl-devel \
1029+
tcl-thread-devel tcllib wget yaml-cpp-devel \
10301030
zlib-devel tzdata redhat-rpm-config rpm-build
10311031

10321032
if [[ "${rhel_version}" == "8" ]]; then
@@ -1038,7 +1038,6 @@ _install_rhel_packages() {
10381038
if [[ "${rhel_version}" == "9" ]]; then
10391039
_execute "Installing additional packages for RHEL 9..." yum install -y \
10401040
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/flex-2.6.4-9.el9.x86_64.rpm \
1041-
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/readline-devel-8.1-4.el9.x86_64.rpm \
10421041
https://rpmfind.net/linux/centos-stream/9-stream/AppStream/x86_64/os/Packages/tcl-devel-8.6.10-7.el9.x86_64.rpm
10431042
fi
10441043

@@ -1063,7 +1062,7 @@ _install_opensuse_packages() {
10631062
binutils clang gcc gcc11-c++ git groff gzip lcov libbz2-devel libffi-devel \
10641063
libgomp1 libomp11-devel libpython3_6m1_0 libqt5-creator libqt5-qtbase \
10651064
libqt5-qtstyleplugins libstdc++6-devel-gcc8 llvm pandoc \
1066-
pcre2-devel pkg-config python3-devel python3-pip readline-devel tcl \
1065+
pcre2-devel pkg-config python3-devel python3-pip tcl \
10671066
tcl-devel tcllib wget yaml-cpp-devel zlib-devel
10681067

10691068
_execute "Setting gcc alternatives..." update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 50
@@ -1111,8 +1110,8 @@ _install_debian_packages() {
11111110
_execute "Installing base packages..." apt-get -y install --no-install-recommends \
11121111
automake autotools-dev binutils bison build-essential clang debhelper \
11131112
devscripts flex g++ gcc git groff lcov libbz2-dev libffi-dev libfl-dev libgomp1 \
1114-
libomp-dev libpcre2-dev libreadline-dev "libtcl${tcl_ver}" \
1115-
pandoc pkg-config python3-dev qt5-image-formats-plugins tcl-dev tcl-tclreadline \
1113+
libomp-dev libpcre2-dev "libtcl${tcl_ver}" \
1114+
pandoc pkg-config python3-dev qt5-image-formats-plugins tcl-dev \
11161115
tcllib unzip wget libyaml-cpp-dev zlib1g-dev tzdata
11171116

11181117
if [[ "${debian_version}" == "10" ]]; then

0 commit comments

Comments
 (0)