[cfe-dev] Should dump methods be LLVM_ATTRIBUTE_USED only in debug builds?
Chandler Carruth
chandlerc at google.com
Fri Jan 3 17:06:15 PST 2014
On Fri, Jan 3, 2014 at 8:03 PM, Nico Weber <thakis at chromium.org> wrote:
> Now that I played with this a bit, I realized that triggering this on
> NDEBUG means it's only stripped in -Asserts builds, independent of Debug
> and Release.
>
> How about something completely different: Let NO_DEAD_STRIP be 1 by
> default in debug builds, and remove used attribute completely? Then the
> dump functions won't be stripped in debug (since no stripping is done), and
> no special attribute is needed. (And the dump() functions get stripped in
> Release+Asserts mode too as long as nothing calls them.)
>
Linker dead stripping is only one of many ways dead stripping can and does
occur. The used attribute is a much more stable way of ensuring that these
debugging aids are available.
Similarly, I really want to be able to call dump methods from a
Release+Asserts binary. The +Asserts means that the increased binary size
shouldn't be a problem, and this can be a huge help when debugging
bootstrap miscompiles and in-the-wild crashers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140103/1ec1ac5d/attachment.html>
More information about the cfe-dev
mailing list