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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120616/45ffc5f1/attachment.html>
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 > MelloWhile 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
OK thanks a lot Michael Spencer! After getting your latest commit now everything compiles on Visual Studio 2012 RC. I'm just playing around to learn. Maybe this is the funniest place to start assessing my possibilities of contributing to llvm in the free time: Writer* createWriterPECOFF(const WriterOptionsPECOFF &options) { assert(0 && "PE/COFF support not implemented yet"); return nullptr; } :-) Best regards! Mello On Sat, Jun 16, 2012 at 10:22 PM, Michael Spencer <bigcheesegs at gmail.com>wrote:> 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120617/6039a9dd/attachment.html>
On Jun 16, 2012, at 4:15 PM, Cesar Mello 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!!!I would be sorely tempted to just do the memset first: ::memset(to, 0, cmdsize); ::memcpy(to, (uint8_t*)&cmd, 12); ::memcpy(&to[12], _name.data(), _name.size()); Easy to understand, easy to convince yourself that it is correct, and slightly slower at runtime. -- Marshall Marshall Clow Idio Software <mailto:mclow.lists at gmail.com> A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait). -- Yu Suzuki