[PATCH] D150221: Add option -fkeep-static-variables to emit all static variables

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 10 08:04:28 PDT 2023


hubert.reinterpretcast added a comment.

In D150221#4332142 <https://reviews.llvm.org/D150221#4332142>, @erichkeane wrote:

>> This is intended to prevent "excessive transformation" to enable migration of existing applications (using a non-Clang compiler) where users further manipulate the object or assembly after compilation.
>
> I don't get what you mean by this?  I don't currently see motivation for this?

The intent is to apply the `__attribute__((__used__))` semantic to static variables (since the front-end is likely to discard them). Additional reasons for using `__attribute__((__used__))` applies: The compiler cannot optimize with the assumption that it sees all direct accesses to the variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150221/new/

https://reviews.llvm.org/D150221



More information about the cfe-commits mailing list