[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
Mon May 15 22:31:19 PDT 2023


hubert.reinterpretcast added a comment.

In D150221#4343546 <https://reviews.llvm.org/D150221#4343546>, @efriedma wrote:

> It's not unprecedented to add flags to copy the behavior of other compilers, to make porting easier, especially when it doesn't place much burden on compiler maintainers.  But what compiler preserves the names/values of static variables by default?  It's not the sort of feature I'd expect anyone to advertise.  And we don't really want to encourage people to use global flags for this sort of thing; applying behavior everywhere has weird effects, and users often don't understand the flags they're using.

This is an adaptation of the IBM XL compiler's `-qstatsym` option, which is meant to generate symbol table entries for static variables. An artifact of that compiler is that static variables are often not discarded even when unused. We attempt to achieve the combined effect using `-fkeep-static-variables`.


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