[clang] [llvm] [Clang][AIX] Add -mloadtime-comment-vars flag to preserve identifying variables (PR #187986)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 22 05:36:25 PDT 2026


https://github.com/AaronBallman commented:

> > Is this effectively a different form of `__attribute__((used))`?
> 
> Not exactly. 

> That depends on how one chooses to draw the line.

Thank you, both, that's a helpful explanation.

> This workaround is not generally applicable. It relies on the variable names being unique, across the inputs to a link-edit/bind operation, for each unique string value.

I looked more carefully at the PR and see this is limited to just AIX and the restrictions in place seem to work for relying on the mangled name like that.

Some silly questions:

* Does AIX also support the Microsoft ABI in addition to Itanium? e.g., will users have to enter two sets of mangled names?
* Objective-C support? I don't know if there's any actual problems there, just something to think about in terms of whether relying on mangled names works there too or if there's additional restrictions needed
* What should happen with code like:
```
static constexpr const char *sccsid = "@(#) option path";
```
and does the answer change if using `constinit` instead?

https://github.com/llvm/llvm-project/pull/187986


More information about the cfe-commits mailing list