Skip to content

[Analysis][AIX] Add !implicit.ref globals as ThinLTO summary ref edges to support pragma comment(copyright) LTO interaction#199398

Draft
tonykuttai wants to merge 5 commits into
mainfrom
users/tonykuttai/ltobugfix
Draft

[Analysis][AIX] Add !implicit.ref globals as ThinLTO summary ref edges to support pragma comment(copyright) LTO interaction#199398
tonykuttai wants to merge 5 commits into
mainfrom
users/tonykuttai/ltobugfix

Conversation

@tonykuttai
Copy link
Copy Markdown
Contributor

Note: This PR adds LTO support for the pragma comment copyright feature implemented in #178184. Should be reviewed/merged after #178184.

LowerCommentStringPass implements #pragma comment(copyright, ...) on AIX by creating a TU-local @__loadtime_comment_str global in the __loadtime_comment section and attaching !implicit.ref metadata to all
defined functions. The PowerPC backend reads !implicit.ref and emits .ref directives from each function csect to the copyright string csect, so the AIX XCOFF linker keeps the copyright string alive whenever any function from the TU is live.

This change teaches ModuleSummaryAnalysis to include globals referenced via !implicit.ref metadata as explicit reference edges in the ThinLTO module summary via a new helper findImplicitRefEdges.

Tony Varghese and others added 5 commits May 23, 2026 20:20
- Emit !aix.copyright.comment from Clang for the pragma.
- Lower it in LLVM to a TU-local string + llvm.used + !implicit.ref.
- Add module-import and backend relocation tests.
Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
…s to support pragma comment(copyright) LTO interaction

Teach ModuleSummaryAnalysis to include globals referenced via
!implicit.ref metadata as explicit reference edges in the ThinLTO
module summary via a new helper findImplicitRefEdges.
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.

1 participant