[PATCH] D40925: Add option -fkeep-static-consts

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 13:40:24 PST 2017


rnk added a comment.

This isn't sufficient, GlobalDCE will remove the internal constant. It's also unlikely that the constant will survive `--gc-sections / -fdata-sections`. A better solution would be to add a new attribute (`__attribute__((nondiscardable))`? too close to `nodiscard`?) that adds the global in question to `@llvm.used` and excludes it from -fdata-sections.


https://reviews.llvm.org/D40925





More information about the cfe-commits mailing list