[lld] r266935 - unbreak COFF/out.test after r266929

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 17:05:13 PDT 2016


On Wednesday, April 20, 2016, Nico Weber via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: nico
> Date: Wed Apr 20 18:30:14 2016
> New Revision: 266935
>
> URL: http://llvm.org/viewvc/llvm-project?rev=266935&view=rev
> Log:
> unbreak COFF/out.test after r266929
>
> Modified:
>     lld/trunk/COFF/DriverUtils.cpp
>     lld/trunk/test/COFF/out.test
>
> Modified: lld/trunk/COFF/DriverUtils.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/DriverUtils.cpp?rev=266935&r1=266934&r2=266935&view=diff
>
> ==============================================================================
> --- lld/trunk/COFF/DriverUtils.cpp (original)
> +++ lld/trunk/COFF/DriverUtils.cpp Wed Apr 20 18:30:14 2016
> @@ -559,6 +559,7 @@ static std::string getImplibPath() {
>  }
>
>  static std::unique_ptr<MemoryBuffer> createEmptyImportLibrary() {
> +#if 0


Is this change intentional?


>    std::string S = (Twine("LIBRARY \"") +
>                     llvm::sys::path::filename(Config->OutputFile) + "\"\n")
>                        .str();
> @@ -578,6 +579,27 @@ static std::unique_ptr<MemoryBuffer> cre
>        MemoryBuffer::getFile(Path2, -1, false);
>    error(BufOrErr, Twine("Failed to open ") + Path2);
>    return MemoryBuffer::getMemBufferCopy((*BufOrErr)->getBuffer());
> +#else
> +  const char kMagic[] = "!<arch>\n";
> +  size_t Size = sizeof(kMagic) + // Include trailing \0.
> +                sizeof(object::ArchiveMemberHeader);
> +  std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getNewUninitMemBuffer(
> +    Size, getImplibPath());
> +  char* B = const_cast<char*>(Buf->getBufferStart());
> +  memcpy(B, kMagic, sizeof(kMagic)); // Include trailing \0.
> +
> +  auto *Hdr =
> +      reinterpret_cast<object::ArchiveMemberHeader *>(B + sizeof(kMagic));
> +  sprintf(Hdr->Name, "%-12s", "/");
> +  sprintf(Hdr->LastModified, "%-12d", 0);
> +  sprintf(Hdr->UID, "%-6d", 0);
> +  sprintf(Hdr->GID, "%-6d", 0);
> +  sprintf(Hdr->AccessMode, "%-8d", 0644);
> +  sprintf(Hdr->Size, "%-10d", 0);
> +  memcpy(Hdr->Terminator, "\n", 2);
> +
> +  return Buf;
> +#endif
>  }
>
>  static std::vector<NewArchiveIterator>
> @@ -594,7 +616,7 @@ readMembers(const object::Archive &Archi
>  }
>
>  // This class creates short import files which is described in
> -// PE/COFF spec 7. Import Library Format.
> +// PE/COFF spec 8. Import Library Format.
>  class ShortImportCreator {
>  public:
>    ShortImportCreator(object::Archive *A, StringRef S) : Parent(A),
> DLLName(S) {}
> @@ -675,6 +697,7 @@ void writeImportLibrary() {
>    for (Export &E : Config->Exports) {
>      if (E.Private)
>        continue;
> +fprintf(stderr, "export %s\n", E.SymbolName.str().c_str());


What about this one?


>      if (E.ExtName.empty()) {
>        Members.push_back(ShortImport.create(
>            E.SymbolName, E.Ordinal, getNameType(E.SymbolName, E.Name),
> E.Data));
> @@ -686,6 +709,7 @@ void writeImportLibrary() {
>    }
>
>    std::string Path = getImplibPath();
> +fprintf(stderr, "writing implib to %s\n", Path.c_str());
>    std::pair<StringRef, std::error_code> Result =
>        writeArchive(Path, Members, /*WriteSymtab*/ true,
> object::Archive::K_GNU,
>                     /*Deterministic*/ true, /*Thin*/ false);
>
> Modified: lld/trunk/test/COFF/out.test
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/out.test?rev=266935&r1=266934&r2=266935&view=diff
>
> ==============================================================================
> --- lld/trunk/test/COFF/out.test (original)
> +++ lld/trunk/test/COFF/out.test Wed Apr 20 18:30:14 2016
> @@ -1,3 +1,4 @@
> +# REQUIRES: winlib
>  # RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj
>
>  # RUN: mkdir -p %T/out/tmp
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <javascript:;>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160420/be25859e/attachment.html>


More information about the llvm-commits mailing list