[compiler-rt] r193098 - Use internal_memset to initialize this variable.

Peter Collingbourne peter at pcc.me.uk
Mon Oct 21 11:33:24 PDT 2013


On Mon, Oct 21, 2013 at 11:19:15AM -0700, David Blaikie wrote:
> On Mon, Oct 21, 2013 at 11:11 AM, Peter Collingbourne <peter at pcc.me.uk>wrote:
> 
> > Author: pcc
> > Date: Mon Oct 21 13:11:57 2013
> > New Revision: 193098
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=193098&view=rev
> > Log:
> > Use internal_memset to initialize this variable.
> >
> > Otherwise, the compiler may use memset in non-optimized builds, which is
> > forbidden in the nolibc part of the runtime.
> >
> 
> Are there no flags you can pass to the compiler to just ensure that doesn't
> happen?

There's -ffreestanding, but as sanitizer_libc.cc explains:

> // FIXME: building the runtime with -ffreestanding is a better idea. However
> // there currently are linktime problems due to PR12396.

> Do we need a comment on this code to explain why it shouldn't be
> transformed into the prior form? And/or a build check to ensure that
> anything with memsets, etc, fails the build?

There is a test (lib/sanitizer_common/tests/sanitizer_nolibc_test*.cc)
which ensures that the nolibc portion of the runtime is libc-free.
The test would otherwise fail if the runtime is built without
optimizations, which (until D1984 lands) isn't possible with the CMake
build as it builds the runtime with optimizations unconditionally
(even in debug builds).

Thanks,
-- 
Peter



More information about the llvm-commits mailing list