Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: OnCompileMain needs to register new link.deps #501

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

RomainMuller
Copy link
Contributor

The OnCompile hook cannot necessarily resolve the transitive dependencies of all link-time dependencies, as those are normally used to avoid creating dependency cycles.

The OnCompileMain hook however MUST resolve the transitive dependencies of everything, as it needs to introduce imports of all synthetic link-time dependencies so that they are correctly registered (their init functions get scheduled, and they get presented to the linker). This was previously not necessarily done, and could result in link-time failures.


This involved re-working the way the link.deps file is added to the _pkg_.a files so that both the OnCompile and OnCompileMain functions contribute to the same closure and it gets written & registered exactly once. As a result Command.OnClose was removed (no longer used).

@RomainMuller RomainMuller requested a review from a team as a code owner January 15, 2025 11:16
RomainMuller added a commit that referenced this pull request Jan 15, 2025
RomainMuller added a commit that referenced this pull request Jan 15, 2025
@RomainMuller RomainMuller added this pull request to the merge queue Jan 16, 2025
Merged via the queue into main with commit c163726 Jan 16, 2025
39 checks passed
@RomainMuller RomainMuller deleted the romain.marcadier/fix-oncompile-main-linkdeps branch January 16, 2025 11:30
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 62.12121% with 25 lines in your changes missing coverage. Please review.

Project coverage is 62.41%. Comparing base (bf4e88f) to head (b3230da).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/toolexec/proxy/compile.go 41.66% 14 Missing and 7 partials ⚠️
internal/toolexec/aspect/oncompile-main.go 84.21% 2 Missing and 1 partial ⚠️
internal/toolexec/aspect/linkdeps/linkdeps.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #501      +/-   ##
==========================================
- Coverage   65.11%   62.41%   -2.70%     
==========================================
  Files         186      186              
  Lines       11348    13327    +1979     
==========================================
+ Hits         7389     8318     +929     
- Misses       3395     4464    +1069     
+ Partials      564      545      -19     
Components Coverage Δ
Generators 74.13% <ø> (-2.03%) ⬇️
Instruments 66.29% <ø> (-7.13%) ⬇️
Go Driver 72.20% <ø> (-5.00%) ⬇️
Toolexec Driver 70.23% <61.53%> (-3.75%) ⬇️
Aspects 76.20% <ø> (-3.90%) ⬇️
Injector 74.95% <ø> (-3.08%) ⬇️
Job Server 63.92% <ø> (-9.17%) ⬇️
Integration Test Suite 57.21% <ø> (-0.37%) ⬇️
Other 62.41% <62.12%> (-2.70%) ⬇️
Files with missing lines Coverage Δ
internal/cmd/toolexec.go 54.54% <100.00%> (-2.13%) ⬇️
internal/toolexec/aspect/oncompile.go 72.30% <100.00%> (+0.17%) ⬆️
internal/toolexec/proxy/proxy.go 69.11% <100.00%> (-3.90%) ⬇️
internal/toolexec/aspect/linkdeps/linkdeps.go 63.56% <66.66%> (-1.49%) ⬇️
internal/toolexec/aspect/oncompile-main.go 63.95% <84.21%> (-1.44%) ⬇️
internal/toolexec/proxy/compile.go 61.45% <41.66%> (-16.81%) ⬇️

... and 160 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants