cl: keep pcline anchors valid under full LTO#2097
Merged
xushiwei merged 2 commits intoJul 19, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
zhouguangyuan0718
force-pushed
the
agent/full-lto-pcline-anchor
branch
3 times, most recently
from
July 16, 2026 00:09
1f0e5f6 to
8e195c2
Compare
zhouguangyuan0718
marked this pull request as ready for review
July 16, 2026 01:45
zhouguangyuan0718
force-pushed
the
agent/full-lto-pcline-anchor
branch
from
July 19, 2026 06:51
8e195c2 to
acfe10d
Compare
zhouguangyuan0718
force-pushed
the
agent/full-lto-pcline-anchor
branch
from
July 19, 2026 13:40
acfe10d to
ad8f754
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
llgo_pclinerecords with their local PC labels instead of source function symbolsSHF_LINK_ORDERanchorruntime/pprofpath in the link with funcinfo enabledWhy
Full LTO can inline and remove
runtime/pprof.writeProfileInternalandwriteRuntimeProfilewhile retaining body-embedded pc-line inline asm. The inline asm previously named the source function as its ELFSHF_LINK_ORDERtarget, so lld rejected it after that function no longer belonged to an emitted section:The local PC label moves with the inline asm and therefore always identifies the final emitted code section, including after Full LTO inlining.
Validation
go test ./cl -run 'PCLine|PCLines'go test ./ssa -run 'PCLine|PCLines'go test ./internal/build -run 'PCLine|PCLines'go test ./internal/build/funcinfo -run 'PCLine|PCLines'go test ./cl -run '^TestRunAndTestFromTestlto$/testpcline$' -count=1go test ./cl -run 'TestCompileRuntimeCallerPCLineUsesLocalAnchor|TestRunAndTestFromTestlto/testpcline' -count=1 -coverprofile=/tmp/pr2097-cl.cover(emitPCLineLabel: 88.9%)LLGO_FUNCINFO_SITES=1 -lto=full, both with and without the LLGo LTO pluginThe regression fixture intentionally has no
out.ll: the test harness disablesLLGO_FUNCINFOwhile capturing an IR golden, which would bypass the metadata link path this PR needs to exercise.