[LLVMdev] Building lld with Visual Studio 2012 RC

Michael Spencer bigcheesegs at gmail.com
Sat Jun 16 18:22:13 PDT 2012


On Sat, Jun 16, 2012 at 4:15 PM, Cesar Mello <cmello at gmail.com> wrote:
> Hi!
>
> I'm trying to build lld Microsoft Visual Studio 2012 RC, but it seems the
> bzero function is not available.
>
> Could memset be used instead of bzero? Or maybe define a bzero for msvc
> using memset.
>
> For example:
>
>       // in-memory matches on-disk, so copy first fields followed by path
>       ::memcpy(to, (uint8_t*)&cmd, 12);
>       ::memcpy(&to[12], _name.data(), _name.size());
>       ::bzero(&to[12+_name.size()], cmdsize-(12+_name.size()));
>
> The bzero line could be changed to:
>
>  ::memset(&to[12+_name.size()], 0, cmdsize-(12+_name.size()));
>
> Thanks a lot for the attention and congratulations for the great work!!!
>
> Best regards
> Mello

While this will make it compile, the code is not valid to begin with.
It is trying to do a raw memory copy of a non standard-layout type.
nameoffset is not guaranteed to directly follow cmdsize.

Fixing this will require quite a few changes, so for now I've
committed your change.

- Michael Spencer




More information about the llvm-dev mailing list