[LLVMdev] asan coverage

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Mar 28 15:18:04 PDT 2014


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?



More information about the llvm-dev mailing list