Skip to content

syn: fix static-library dependency cycle between syn_flow and syn_lib#10557

Merged
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
gudeh:syn-fix-build
Jun 1, 2026
Merged

syn: fix static-library dependency cycle between syn_flow and syn_lib#10557
maliberty merged 1 commit into
The-OpenROAD-Project:masterfrom
gudeh:syn-fix-build

Conversation

@gudeh
Copy link
Copy Markdown
Contributor

@gudeh gudeh commented May 29, 2026

libsyn_flow.a references Synthesis::dontUse(), defined in syn_lib. Add syn_lib to the link line to resolve it. Matches Bazel BUILD.

Summary

This fixes build issues I have been facing.

Type of Change

  • Bug fix

Impact

Succesfully build when using ORFS build script.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

libsyn_flow.a references Synthesis::dontUse(), defined in syn_lib.
Add syn_lib to the link line to resolve it. Matches Bazel BUILD.

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh gudeh requested a review from a team as a code owner May 29, 2026 18:04
@gudeh gudeh requested a review from povik May 29, 2026 18:04
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates src/syn/test/CMakeLists.txt to link syn_lib to several test targets and adjusts the linking order. The reviewer notes that these changes introduce a circular dependency between syn_flow and syn_lib, which can cause build failures on platforms with single-pass linkers. They suggest breaking this dependency by refactoring how syn_flow accesses syn_lib data, such as using a callback or passing the data directly.

foreach(_t opt_test bitblast_test)
add_executable(${_t} ${_t}.cc)
target_link_libraries(${_t} ${_syn_test_libs} syn_flow syn_ir)
target_link_libraries(${_t} ${_syn_test_libs} syn_flow syn_lib syn_ir)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While adding syn_lib and adjusting the link order resolves the immediate build issue on your local environment, it exposes a circular dependency between syn_flow and syn_lib (since syn_lib already links to syn_flow in src/syn/src/CMakeLists.txt).\n\nWith static libraries, circular dependencies (syn_lib -> syn_flow and syn_flow -> syn_lib) are highly fragile. A single-pass linker (like standard GNU ld) cannot resolve symbols in both directions unless libraries are repeated (e.g., syn_flow syn_lib syn_flow) or linker groups are used. This can lead to build failures on other platforms or toolchains.\n\n### Suggested Solution\nTo ensure a robust and portable build, we should break the circular dependency by removing syn_flow's direct dependency on syn_lib. Since syn_flow only references Synthesis::dontUse(), you can:\n1. Pass a callback or interface: Define an abstract interface or a std::function callback in syn_flow (or syn_ir) that queries the dont_use status. Synthesis can implement/provide this callback when invoking syn_flow.\n2. Pass the data directly: Pass the set of dont_use cells as a parameter to the flow.\n\nThis keeps the dependency graph as a clean Directed Acyclic Graph (DAG): syn_lib -> syn_flow -> syn_ir.

@gudeh gudeh requested a review from maliberty June 1, 2026 13:13
@maliberty
Copy link
Copy Markdown
Member

@povik why is there a cycle between syn_flow and syn_lib?

@povik
Copy link
Copy Markdown
Contributor

povik commented Jun 1, 2026

syn_lib is the entry point and calls individual syn_flow passes. The dependency back from syn_flow to syn_lib is because of one Synthesis::dontUse helper to query the dont use status of individual cells. I think we should collapse the libraries into one. That has been already done on the Bazel side.

@maliberty
Copy link
Copy Markdown
Member

@povik should we make that change instead of this one?

@povik
Copy link
Copy Markdown
Contributor

povik commented Jun 1, 2026

We should make it eventually but we can merge this one in the interim.

@maliberty maliberty merged commit ce81a71 into The-OpenROAD-Project:master Jun 1, 2026
17 checks passed
@maliberty
Copy link
Copy Markdown
Member

In the long term it seems overly heavy to pass the whole top level engine just to get a dontuse method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants