[LLVMdev] asan coverage

Eric Christopher echristo at gmail.com
Fri Mar 28 15:47:24 PDT 2014


On Fri, Mar 28, 2014 at 3:18 PM, Duncan P. N. Exon Smith
<dexonsmith at apple.com> wrote:
>
> On 2014 Mar 28, at 14:59, Bob Wilson <bob.wilson at apple.com> wrote:
>
>>
>> On Mar 28, 2014, at 1:33 AM, Kostya Serebryany <kcc at google.com> wrote:
>>
>>> Some more data on code size.
>>>
>>> I've build CPU2006/483.xalancbmk with
>>> a) -O2 -fsanitize=address -m64 -gline-tables-only -mllvm -asan-coverage=1
>>> b) -O2 -fsanitize=address -m64 -gline-tables-only -fprofile-instr-generate
>>>
>>> The first is 27Mb and the second is 48Mb.
>>>
>>> The extra size comes from __llvm_prf_* sections.
>>> You may be able to make these sections more compact, but you will not make them tiny.
>>>
>>> The instrumentation code generated by -asan-coverage=1 is less efficient than -fprofile-instr-generate
>>> in several ways (slower, fatter, provides less data).
>>> But it does not add any extra sections to the binary and wins in the overall binary size.
>>> Ideally, I'd like to see such options for -fprofile-instr-generate as well.
>>>
>>> --kcc
>>
>> It might make sense to move at least some of the counters into the .bss section so they don't take up space in the executable.
>>
>> We're also seeing that the instrumentation bloats the code size much more than expected and we're still investigating to see why that is the case.
>
> The __llvm_prf_cnts section is likely the largest.  It's zero-initialized,
> so it's a good candidate for .bss or similar.  The counters are currently in
> their own section to make write out easy (just one big array), but we could
> change that.  Or, is there linker magic that can make a special section
> behave like the .bss?

Possibly. The zerofill stuff is a bit weird, but you should be able to
specify a large enough block to zerofill and a concrete section. A
separate section with the S_ZEROFILL attribute would probably work to
get it all initialized and just switch sections and not use the
zerofill directive.

-eric

> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



More information about the llvm-dev mailing list