<br><br>On Wednesday, April 20, 2016, Nico Weber via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: nico<br>
Date: Wed Apr 20 18:30:14 2016<br>
New Revision: 266935<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=266935&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=266935&view=rev</a><br>
Log:<br>
unbreak COFF/out.test after r266929<br>
<br>
Modified:<br>
    lld/trunk/COFF/DriverUtils.cpp<br>
    lld/trunk/test/COFF/out.test<br>
<br>
Modified: lld/trunk/COFF/DriverUtils.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=266935&r1=266934&r2=266935&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=266935&r1=266934&r2=266935&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/COFF/DriverUtils.cpp (original)<br>
+++ lld/trunk/COFF/DriverUtils.cpp Wed Apr 20 18:30:14 2016<br>
@@ -559,6 +559,7 @@ static std::string getImplibPath() {<br>
 }<br>
<br>
 static std::unique_ptr<MemoryBuffer> createEmptyImportLibrary() {<br>
+#if 0</blockquote><div><br></div><div>Is this change intentional?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   std::string S = (Twine("LIBRARY \"") +<br>
                    llvm::sys::path::filename(Config->OutputFile) + "\"\n")<br>
                       .str();<br>
@@ -578,6 +579,27 @@ static std::unique_ptr<MemoryBuffer> cre<br>
       MemoryBuffer::getFile(Path2, -1, false);<br>
   error(BufOrErr, Twine("Failed to open ") + Path2);<br>
   return MemoryBuffer::getMemBufferCopy((*BufOrErr)->getBuffer());<br>
+#else<br>
+  const char kMagic[] = "!<arch>\n";<br>
+  size_t Size = sizeof(kMagic) + // Include trailing \0.<br>
+                sizeof(object::ArchiveMemberHeader);<br>
+  std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getNewUninitMemBuffer(<br>
+    Size, getImplibPath());<br>
+  char* B = const_cast<char*>(Buf->getBufferStart());<br>
+  memcpy(B, kMagic, sizeof(kMagic)); // Include trailing \0.<br>
+<br>
+  auto *Hdr =<br>
+      reinterpret_cast<object::ArchiveMemberHeader *>(B + sizeof(kMagic));<br>
+  sprintf(Hdr->Name, "%-12s", "/");<br>
+  sprintf(Hdr->LastModified, "%-12d", 0);<br>
+  sprintf(Hdr->UID, "%-6d", 0);<br>
+  sprintf(Hdr->GID, "%-6d", 0);<br>
+  sprintf(Hdr->AccessMode, "%-8d", 0644);<br>
+  sprintf(Hdr->Size, "%-10d", 0);<br>
+  memcpy(Hdr->Terminator, "\n", 2);<br>
+<br>
+  return Buf;<br>
+#endif<br>
 }<br>
<br>
 static std::vector<NewArchiveIterator><br>
@@ -594,7 +616,7 @@ readMembers(const object::Archive &Archi<br>
 }<br>
<br>
 // This class creates short import files which is described in<br>
-// PE/COFF spec 7. Import Library Format.<br>
+// PE/COFF spec 8. Import Library Format.<br>
 class ShortImportCreator {<br>
 public:<br>
   ShortImportCreator(object::Archive *A, StringRef S) : Parent(A), DLLName(S) {}<br>
@@ -675,6 +697,7 @@ void writeImportLibrary() {<br>
   for (Export &E : Config->Exports) {<br>
     if (E.Private)<br>
       continue;<br>
+fprintf(stderr, "export %s\n", E.SymbolName.str().c_str());</blockquote><div><br></div><div>What about this one?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     if (E.ExtName.empty()) {<br>
       Members.push_back(ShortImport.create(<br>
           E.SymbolName, E.Ordinal, getNameType(E.SymbolName, E.Name), E.Data));<br>
@@ -686,6 +709,7 @@ void writeImportLibrary() {<br>
   }<br>
<br>
   std::string Path = getImplibPath();<br>
+fprintf(stderr, "writing implib to %s\n", Path.c_str());<br>
   std::pair<StringRef, std::error_code> Result =<br>
       writeArchive(Path, Members, /*WriteSymtab*/ true, object::Archive::K_GNU,<br>
                    /*Deterministic*/ true, /*Thin*/ false);<br>
<br>
Modified: lld/trunk/test/COFF/out.test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/out.test?rev=266935&r1=266934&r2=266935&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/out.test?rev=266935&r1=266934&r2=266935&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/test/COFF/out.test (original)<br>
+++ lld/trunk/test/COFF/out.test Wed Apr 20 18:30:14 2016<br>
@@ -1,3 +1,4 @@<br>
+# REQUIRES: winlib<br>
 # RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj<br>
<br>
 # RUN: mkdir -p %T/out/tmp<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'llvm-commits@lists.llvm.org')">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote>