<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 16, 2014 at 1:37 AM, Timur Iskhodzhanov <span dir="ltr"><<a href="mailto:timurrrr@google.com" target="_blank">timurrrr@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Worked around in r206363.<br>
Please revisit when you have time!<br></blockquote><div><br></div><div>Restored the original assertion with a more compatible representation in SVN r206445.</div><div><br></div><div>Thanks for the interim fix!</div><div>
 </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
2014-04-16 12:23 GMT+04:00 Timur Iskhodzhanov <<a href="mailto:timurrrr@google.com">timurrrr@google.com</a>>:<br>
<div class=""><div class="h5">> VS2013 doesn't seem to like that:<br>
> lib\MC\WinCOFFObjectWriter.cpp(636) : error C2070: 'unknown': illegal<br>
> sizeof operand<br>
> lib\MC\WinCOFFObjectWriter.cpp(637) : error C2338: size mismatch for<br>
> COFF::AuxiliaryFile::FileName<br>
><br>
> 2014-04-16 8:15 GMT+04:00 Saleem Abdulrasool <<a href="mailto:compnerd@compnerd.org">compnerd@compnerd.org</a>>:<br>
>> Author: compnerd<br>
>> Date: Tue Apr 15 23:15:32 2014<br>
>> New Revision: 206355<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=206355&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=206355&view=rev</a><br>
>> Log:<br>
>> COFF: add support for .file symbols<br>
>><br>
>> Add support for emitting .file records.  This is mostly a quality of<br>
>> implementation change (more complete support for COFF file emission) that was<br>
>> noticed while working on COFF file emission for Windows on ARM.<br>
>><br>
>> A .file record is emitted as a symbol with storage class FILE (103) and the name<br>
>> ".file".  A series of auxiliary format 4 records follow which contain the file<br>
>> name.  The filename is stored as an ANSI string and is padded with NULL if the<br>
>> length is not a multiple of COFF::SymbolSize (18).<br>
>><br>
>> Added:<br>
>>     llvm/trunk/test/MC/COFF/file.s<br>
>> Modified:<br>
>>     llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp<br>
>>     llvm/trunk/lib/MC/WinCOFFStreamer.cpp<br>
>><br>
>> Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=206355&r1=206354&r2=206355&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=206355&r1=206354&r2=206355&view=diff</a><br>

>> ==============================================================================<br>
>> --- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)<br>
>> +++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Apr 15 23:15:32 2014<br>
>> @@ -633,6 +633,35 @@ void WinCOFFObjectWriter::ExecutePostLay<br>
>>    // "Define" each section & symbol. This creates section & symbol<br>
>>    // entries in the staging area.<br>
>><br>
>> +  static_assert(sizeof(COFF::AuxiliaryFile::FileName) == COFF::SymbolSize,<br>
>> +                "size mismatch for COFF::AuxiliaryFile::FileName");<br>
>> +  for (auto FI = Asm.file_names_begin(), FE = Asm.file_names_end();<br>
>> +       FI != FE; ++FI) {<br>
>> +    // round up to calculate the number of auxiliary symbols required<br>
>> +    unsigned Count = (FI->size() + COFF::SymbolSize) / COFF::SymbolSize;<br>
>> +<br>
>> +    COFFSymbol *file = createSymbol(".file");<br>
>> +    file->Data.StorageClass = COFF::IMAGE_SYM_CLASS_FILE;<br>
>> +    file->Aux.resize(Count);<br>
>> +<br>
>> +    unsigned Offset = 0;<br>
>> +    unsigned Length = FI->size();<br>
>> +    for (auto & Aux : file->Aux) {<br>
>> +      Aux.AuxType = ATFile;<br>
>> +<br>
>> +      if (Length > COFF::SymbolSize) {<br>
>> +        memcpy(Aux.Aux.File.FileName, FI->c_str() + Offset, COFF::SymbolSize);<br>
>> +        Length = Length - COFF::SymbolSize;<br>
>> +      } else {<br>
>> +        memcpy(Aux.Aux.File.FileName, FI->c_str() + Offset, Length);<br>
>> +        memset(&Aux.Aux.File.FileName[Length], 0, COFF::SymbolSize - Length);<br>
>> +        Length = 0;<br>
>> +      }<br>
>> +<br>
>> +      Offset = Offset + COFF::SymbolSize;<br>
>> +    }<br>
>> +  }<br>
>> +<br>
>>    for (MCAssembler::const_iterator i = Asm.begin(), e = Asm.end(); i != e; i++)<br>
>>      DefineSection(*i);<br>
>><br>
>><br>
>> Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=206355&r1=206354&r2=206355&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=206355&r1=206354&r2=206355&view=diff</a><br>

>> ==============================================================================<br>
>> --- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)<br>
>> +++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Tue Apr 15 23:15:32 2014<br>
>> @@ -266,8 +266,7 @@ void WinCOFFStreamer::EmitTBSSSymbol(con<br>
>>  }<br>
>><br>
>>  void WinCOFFStreamer::EmitFileDirective(StringRef Filename) {<br>
>> -  // Ignore for now, linkers don't care, and proper debug<br>
>> -  // info will be a much large effort.<br>
>> +  getAssembler().addFileName(Filename);<br>
>>  }<br>
>><br>
>>  // TODO: Implement this if you want to emit .comment section in COFF obj files.<br>
>><br>
>> Added: llvm/trunk/test/MC/COFF/file.s<br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/file.s?rev=206355&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/file.s?rev=206355&view=auto</a><br>

>> ==============================================================================<br>
>> --- llvm/trunk/test/MC/COFF/file.s (added)<br>
>> +++ llvm/trunk/test/MC/COFF/file.s Tue Apr 15 23:15:32 2014<br>
>> @@ -0,0 +1,17 @@<br>
>> +// RUN: llvm-mc -triple i686-windows -filetype obj %s -o - | llvm-objdump -t - \<br>
>> +// RUN:   | FileCheck %s -check-prefix CHECK-PRINT<br>
>> +<br>
>> +       .file "null-padded.asm"<br>
>> +// CHECK-PRINT: .file<br>
>> +// CHECK-PRINT-NEXT: AUX null-padded.asm{{$}}<br>
>> +<br>
>> +       .file "eighteen-chars.asm"<br>
>> +<br>
>> +// CHECK-PRINT: .file<br>
>> +// CHECK-PRINT-NEXT: AUX eighteen-chars.asm{{$}}<br>
>> +<br>
>> +       .file "multiple-auxiliary-entries.asm"<br>
>> +<br>
>> +// CHECK-PRINT: .file<br>
>> +// CHECK-PRINT-NEXT: AUX multiple-auxiliary-entries.asm{{$}}<br>
>> +<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>