Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2019 17:49:30 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r351718 - in vendor/lld/dist-release_90: . COFF ELF ELF/Arch docs
Message-ID:  <201909021749.x82HnU1o020001@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Sep  2 17:49:30 2019
New Revision: 351718
URL: https://svnweb.freebsd.org/changeset/base/351718

Log:
  Vendor import of lld release_90 branch r370514:
  https://llvm.org/svn/llvm-project/lld/branches/release_90@370514

Modified:
  vendor/lld/dist-release_90/CMakeLists.txt
  vendor/lld/dist-release_90/COFF/Config.h
  vendor/lld/dist-release_90/COFF/Driver.cpp
  vendor/lld/dist-release_90/COFF/Driver.h
  vendor/lld/dist-release_90/COFF/InputFiles.cpp
  vendor/lld/dist-release_90/COFF/InputFiles.h
  vendor/lld/dist-release_90/COFF/SymbolTable.cpp
  vendor/lld/dist-release_90/COFF/SymbolTable.h
  vendor/lld/dist-release_90/COFF/Symbols.cpp
  vendor/lld/dist-release_90/COFF/Symbols.h
  vendor/lld/dist-release_90/COFF/Writer.cpp
  vendor/lld/dist-release_90/ELF/Arch/PPC.cpp
  vendor/lld/dist-release_90/ELF/Arch/PPC64.cpp
  vendor/lld/dist-release_90/ELF/InputFiles.cpp
  vendor/lld/dist-release_90/ELF/Symbols.cpp
  vendor/lld/dist-release_90/ELF/Symbols.h
  vendor/lld/dist-release_90/docs/ReleaseNotes.rst

Modified: vendor/lld/dist-release_90/CMakeLists.txt
==============================================================================
--- vendor/lld/dist-release_90/CMakeLists.txt	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/CMakeLists.txt	Mon Sep  2 17:49:30 2019	(r351718)
@@ -56,7 +56,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   include(HandleLLVMOptions)
 
   if(LLVM_INCLUDE_TESTS)
-    set(Python_ADDITIONAL_VERSIONS 2.7)
     include(FindPythonInterp)
     if(NOT PYTHONINTERP_FOUND)
       message(FATAL_ERROR

Modified: vendor/lld/dist-release_90/COFF/Config.h
==============================================================================
--- vendor/lld/dist-release_90/COFF/Config.h	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/Config.h	Mon Sep  2 17:49:30 2019	(r351718)
@@ -189,6 +189,7 @@ struct Configuration {
   // Used for /thinlto-object-suffix-replace:
   std::pair<llvm::StringRef, llvm::StringRef> thinLTOObjectSuffixReplace;
 
+  uint64_t align = 4096;
   uint64_t imageBase = -1;
   uint64_t fileAlign = 512;
   uint64_t stackReserve = 1024 * 1024;

Modified: vendor/lld/dist-release_90/COFF/Driver.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/Driver.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/Driver.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -36,6 +36,7 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/LEB128.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/TarWriter.h"
@@ -270,13 +271,12 @@ void LinkerDriver::addArchiveBuffer(MemoryBufferRef mb
 }
 
 void LinkerDriver::enqueueArchiveMember(const Archive::Child &c,
-                                        StringRef symName,
+                                        const Archive::Symbol &sym,
                                         StringRef parentName) {
 
-  auto reportBufferError = [=](Error &&e,
-                              StringRef childName) {
+  auto reportBufferError = [=](Error &&e, StringRef childName) {
     fatal("could not get the buffer for the member defining symbol " +
-          symName + ": " + parentName + "(" + childName + "): " +
+          toCOFFString(sym) + ": " + parentName + "(" + childName + "): " +
           toString(std::move(e)));
   };
 
@@ -287,7 +287,8 @@ void LinkerDriver::enqueueArchiveMember(const Archive:
       reportBufferError(mbOrErr.takeError(), check(c.getFullName()));
     MemoryBufferRef mb = mbOrErr.get();
     enqueueTask([=]() {
-      driver->addArchiveBuffer(mb, symName, parentName, offsetInArchive);
+      driver->addArchiveBuffer(mb, toCOFFString(sym), parentName,
+                               offsetInArchive);
     });
     return;
   }
@@ -295,15 +296,16 @@ void LinkerDriver::enqueueArchiveMember(const Archive:
   std::string childName = CHECK(
       c.getFullName(),
       "could not get the filename for the member defining symbol " +
-      symName);
+      toCOFFString(sym));
   auto future = std::make_shared<std::future<MBErrPair>>(
       createFutureForFile(childName));
   enqueueTask([=]() {
     auto mbOrErr = future->get();
     if (mbOrErr.second)
       reportBufferError(errorCodeToError(mbOrErr.second), childName);
-    driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)), symName,
-                             parentName, /* OffsetInArchive */ 0);
+    driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)),
+                             toCOFFString(sym), parentName,
+                             /*OffsetInArchive=*/0);
   });
 }
 
@@ -1053,6 +1055,12 @@ void LinkerDriver::maybeExportMinGWSymbols(const opt::
   });
 }
 
+static const char *libcallRoutineNames[] = {
+#define HANDLE_LIBCALL(code, name) name,
+#include "llvm/IR/RuntimeLibcalls.def"
+#undef HANDLE_LIBCALL
+};
+
 void LinkerDriver::link(ArrayRef<const char *> argsArr) {
   // Needed for LTO.
   InitializeAllTargetInfos();
@@ -1421,6 +1429,13 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr
   for (auto *arg : args.filtered(OPT_section))
     parseSection(arg->getValue());
 
+  // Handle /align
+  if (auto *arg = args.getLastArg(OPT_align)) {
+    parseNumbers(arg->getValue(), &config->align);
+    if (!isPowerOf2_64(config->align))
+      error("/align: not a power of two: " + StringRef(arg->getValue()));
+  }
+
   // Handle /aligncomm
   for (auto *arg : args.filtered(OPT_aligncomm))
     parseAligncomm(arg->getValue());
@@ -1747,6 +1762,15 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr
         if (!u->weakAlias)
           u->weakAlias = symtab->addUndefined(to);
     }
+
+    // If any inputs are bitcode files, the LTO code generator may create
+    // references to library functions that are not explicit in the bitcode
+    // file's symbol table. If any of those library functions are defined in a
+    // bitcode file in an archive member, we need to arrange to use LTO to
+    // compile those archive members by adding them to the link beforehand.
+    if (!BitcodeFile::instances.empty())
+      for (const char *s : libcallRoutineNames)
+        symtab->addLibcall(s);
 
     // Windows specific -- if __load_config_used can be resolved, resolve it.
     if (symtab->findUnderscore("_load_config_used"))

Modified: vendor/lld/dist-release_90/COFF/Driver.h
==============================================================================
--- vendor/lld/dist-release_90/COFF/Driver.h	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/Driver.h	Mon Sep  2 17:49:30 2019	(r351718)
@@ -72,7 +72,7 @@ class LinkerDriver { (public)
   void parseDirectives(InputFile *file);
 
   // Used by ArchiveFile to enqueue members.
-  void enqueueArchiveMember(const Archive::Child &c, StringRef symName,
+  void enqueueArchiveMember(const Archive::Child &c, const Archive::Symbol &sym,
                             StringRef parentName);
 
   MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> mb);

Modified: vendor/lld/dist-release_90/COFF/InputFiles.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/InputFiles.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/InputFiles.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -85,16 +85,16 @@ void ArchiveFile::parse() {
 }
 
 // Returns a buffer pointing to a member file containing a given symbol.
-void ArchiveFile::addMember(const Archive::Symbol *sym) {
+void ArchiveFile::addMember(const Archive::Symbol &sym) {
   const Archive::Child &c =
-      CHECK(sym->getMember(),
-            "could not get the member for symbol " + sym->getName());
+      CHECK(sym.getMember(),
+            "could not get the member for symbol " + toCOFFString(sym));
 
   // Return an empty buffer if we have already returned the same buffer.
   if (!seen.insert(c.getChildOffset()).second)
     return;
 
-  driver->enqueueArchiveMember(c, sym->getName(), getName());
+  driver->enqueueArchiveMember(c, sym, getName());
 }
 
 std::vector<MemoryBufferRef> getArchiveMembers(Archive *file) {

Modified: vendor/lld/dist-release_90/COFF/InputFiles.h
==============================================================================
--- vendor/lld/dist-release_90/COFF/InputFiles.h	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/InputFiles.h	Mon Sep  2 17:49:30 2019	(r351718)
@@ -96,7 +96,7 @@ class ArchiveFile : public InputFile { (public)
   // Enqueues an archive member load for the given symbol. If we've already
   // enqueued a load for the same archive member, this function does nothing,
   // which ensures that we don't load the same member more than once.
-  void addMember(const Archive::Symbol *sym);
+  void addMember(const Archive::Symbol &sym);
 
 private:
   std::unique_ptr<Archive> file;

Modified: vendor/lld/dist-release_90/COFF/SymbolTable.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/SymbolTable.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/SymbolTable.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -179,7 +179,7 @@ void SymbolTable::loadMinGWAutomaticImports() {
     log("Loading lazy " + l->getName() + " from " + l->file->getName() +
         " for automatic import");
     l->pendingArchiveLoad = true;
-    l->file->addMember(&l->sym);
+    l->file->addMember(l->sym);
   }
 }
 
@@ -363,13 +363,13 @@ Symbol *SymbolTable::addUndefined(StringRef name, Inpu
   if (auto *l = dyn_cast<Lazy>(s)) {
     if (!s->pendingArchiveLoad) {
       s->pendingArchiveLoad = true;
-      l->file->addMember(&l->sym);
+      l->file->addMember(l->sym);
     }
   }
   return s;
 }
 
-void SymbolTable::addLazy(ArchiveFile *f, const Archive::Symbol sym) {
+void SymbolTable::addLazy(ArchiveFile *f, const Archive::Symbol &sym) {
   StringRef name = sym.getName();
   Symbol *s;
   bool wasInserted;
@@ -382,7 +382,7 @@ void SymbolTable::addLazy(ArchiveFile *f, const Archiv
   if (!u || u->weakAlias || s->pendingArchiveLoad)
     return;
   s->pendingArchiveLoad = true;
-  f->addMember(&sym);
+  f->addMember(sym);
 }
 
 void SymbolTable::reportDuplicate(Symbol *existing, InputFile *newFile) {
@@ -503,6 +503,18 @@ Symbol *SymbolTable::addImportThunk(StringRef name, De
 
   reportDuplicate(s, id->file);
   return nullptr;
+}
+
+void SymbolTable::addLibcall(StringRef name) {
+  Symbol *sym = findUnderscore(name);
+  if (!sym)
+    return;
+
+  if (Lazy *l = dyn_cast<Lazy>(sym)) {
+    MemoryBufferRef mb = l->getMemberBuffer();
+    if (identify_magic(mb.getBuffer()) == llvm::file_magic::bitcode)
+      addUndefined(sym->getName());
+  }
 }
 
 std::vector<Chunk *> SymbolTable::getChunks() {

Modified: vendor/lld/dist-release_90/COFF/SymbolTable.h
==============================================================================
--- vendor/lld/dist-release_90/COFF/SymbolTable.h	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/SymbolTable.h	Mon Sep  2 17:49:30 2019	(r351718)
@@ -83,7 +83,7 @@ class SymbolTable { (public)
   Symbol *addAbsolute(StringRef n, uint64_t va);
 
   Symbol *addUndefined(StringRef name, InputFile *f, bool isWeakAlias);
-  void addLazy(ArchiveFile *f, const Archive::Symbol sym);
+  void addLazy(ArchiveFile *f, const Archive::Symbol &sym);
   Symbol *addAbsolute(StringRef n, COFFSymbolRef s);
   Symbol *addRegular(InputFile *f, StringRef n,
                      const llvm::object::coff_symbol_generic *s = nullptr,
@@ -97,6 +97,7 @@ class SymbolTable { (public)
   Symbol *addImportData(StringRef n, ImportFile *f);
   Symbol *addImportThunk(StringRef name, DefinedImportData *s,
                          uint16_t machine);
+  void addLibcall(StringRef name);
 
   void reportDuplicate(Symbol *existing, InputFile *newFile);
 

Modified: vendor/lld/dist-release_90/COFF/Symbols.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/Symbols.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/Symbols.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -20,18 +20,23 @@ using namespace llvm::object;
 
 using namespace lld::coff;
 
+namespace lld {
+
 static_assert(sizeof(SymbolUnion) <= 48,
               "symbols should be optimized for memory usage");
 
 // Returns a symbol name for an error message.
-std::string lld::toString(coff::Symbol &b) {
+static std::string demangle(StringRef symName) {
   if (config->demangle)
-    if (Optional<std::string> s = lld::demangleMSVC(b.getName()))
+    if (Optional<std::string> s = demangleMSVC(symName))
       return *s;
-  return b.getName();
+  return symName;
 }
+std::string toString(coff::Symbol &b) { return demangle(b.getName()); }
+std::string toCOFFString(const Archive::Symbol &b) {
+  return demangle(b.getName());
+}
 
-namespace lld {
 namespace coff {
 
 StringRef Symbol::getName() {
@@ -112,6 +117,15 @@ Defined *Undefined::getWeakAlias() {
     if (auto *d = dyn_cast<Defined>(a))
       return d;
   return nullptr;
+}
+
+MemoryBufferRef Lazy::getMemberBuffer() {
+  Archive::Child c =
+    CHECK(sym.getMember(),
+          "could not get the member for symbol " + toCOFFString(sym));
+  return CHECK(c.getMemoryBufferRef(),
+      "could not get the buffer for the member defining symbol " +
+      toCOFFString(sym));
 }
 } // namespace coff
 } // namespace lld

Modified: vendor/lld/dist-release_90/COFF/Symbols.h
==============================================================================
--- vendor/lld/dist-release_90/COFF/Symbols.h	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/Symbols.h	Mon Sep  2 17:49:30 2019	(r351718)
@@ -21,6 +21,14 @@
 #include <vector>
 
 namespace lld {
+
+std::string toString(coff::Symbol &b);
+
+// There are two different ways to convert an Archive::Symbol to a string:
+// One for Microsoft name mangling and one for Itanium name mangling.
+// Call the functions toCOFFString and toELFString, not just toString.
+std::string toCOFFString(const coff::Archive::Symbol &b);
+
 namespace coff {
 
 using llvm::object::Archive;
@@ -257,6 +265,8 @@ class Lazy : public Symbol { (public)
 
   static bool classof(const Symbol *s) { return s->kind() == LazyKind; }
 
+  MemoryBufferRef getMemberBuffer();
+
   ArchiveFile *file;
 
 private:
@@ -429,7 +439,6 @@ void replaceSymbol(Symbol *s, ArgT &&... arg) {
 }
 } // namespace coff
 
-std::string toString(coff::Symbol &b);
 } // namespace lld
 
 #endif

Modified: vendor/lld/dist-release_90/COFF/Writer.cpp
==============================================================================
--- vendor/lld/dist-release_90/COFF/Writer.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/COFF/Writer.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -626,6 +626,9 @@ void Writer::run() {
 
   writeMapFile(outputSections);
 
+  if (errorCount())
+    return;
+
   ScopedTimer t2(diskCommitTimer);
   if (auto e = buffer->commit())
     fatal("failed to write the output file: " + toString(std::move(e)));
@@ -1205,9 +1208,11 @@ void Writer::assignAddresses() {
   sizeOfHeaders +=
       config->is64() ? sizeof(pe32plus_header) : sizeof(pe32_header);
   sizeOfHeaders = alignTo(sizeOfHeaders, config->fileAlign);
-  uint64_t rva = pageSize; // The first page is kept unmapped.
   fileSize = sizeOfHeaders;
 
+  // The first page is kept unmapped.
+  uint64_t rva = alignTo(sizeOfHeaders, config->align);
+
   for (OutputSection *sec : outputSections) {
     if (sec == relocSec)
       addBaserels();
@@ -1237,10 +1242,10 @@ void Writer::assignAddresses() {
     sec->header.SizeOfRawData = rawSize;
     if (rawSize != 0)
       sec->header.PointerToRawData = fileSize;
-    rva += alignTo(virtualSize, pageSize);
+    rva += alignTo(virtualSize, config->align);
     fileSize += alignTo(rawSize, config->fileAlign);
   }
-  sizeOfImage = alignTo(rva, pageSize);
+  sizeOfImage = alignTo(rva, config->align);
 
   // Assign addresses to sections in MergeChunks.
   for (MergeChunk *mc : MergeChunk::instances)
@@ -1309,7 +1314,7 @@ template <typename PEHeaderTy> void Writer::writeHeade
   pe->MinorLinkerVersion = 0;
 
   pe->ImageBase = config->imageBase;
-  pe->SectionAlignment = pageSize;
+  pe->SectionAlignment = config->align;
   pe->FileAlignment = config->fileAlign;
   pe->MajorImageVersion = config->majorImageVersion;
   pe->MinorImageVersion = config->minorImageVersion;

Modified: vendor/lld/dist-release_90/ELF/Arch/PPC.cpp
==============================================================================
--- vendor/lld/dist-release_90/ELF/Arch/PPC.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/ELF/Arch/PPC.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -190,6 +190,13 @@ bool PPC::inBranchRange(RelType type, uint64_t src, ui
 RelExpr PPC::getRelExpr(RelType type, const Symbol &s,
                         const uint8_t *loc) const {
   switch (type) {
+  case R_PPC_NONE:
+    return R_NONE;
+  case R_PPC_ADDR16_HA:
+  case R_PPC_ADDR16_HI:
+  case R_PPC_ADDR16_LO:
+  case R_PPC_ADDR32:
+    return R_ABS;
   case R_PPC_DTPREL16:
   case R_PPC_DTPREL16_HA:
   case R_PPC_DTPREL16_HI:
@@ -227,7 +234,9 @@ RelExpr PPC::getRelExpr(RelType type, const Symbol &s,
   case R_PPC_TPREL16_HI:
     return R_TLS;
   default:
-    return R_ABS;
+    error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
+          ") against symbol " + toString(s));
+    return R_NONE;
   }
 }
 
@@ -319,7 +328,7 @@ void PPC::relocateOne(uint8_t *loc, RelType type, uint
     break;
   }
   default:
-    error(getErrorLocation(loc) + "unrecognized relocation " + toString(type));
+    llvm_unreachable("unknown relocation");
   }
 }
 

Modified: vendor/lld/dist-release_90/ELF/Arch/PPC64.cpp
==============================================================================
--- vendor/lld/dist-release_90/ELF/Arch/PPC64.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/ELF/Arch/PPC64.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -532,6 +532,21 @@ void PPC64::relaxTlsIeToLe(uint8_t *loc, RelType type,
 RelExpr PPC64::getRelExpr(RelType type, const Symbol &s,
                           const uint8_t *loc) const {
   switch (type) {
+  case R_PPC64_NONE:
+    return R_NONE;
+  case R_PPC64_ADDR16:
+  case R_PPC64_ADDR16_DS:
+  case R_PPC64_ADDR16_HA:
+  case R_PPC64_ADDR16_HI:
+  case R_PPC64_ADDR16_HIGHER:
+  case R_PPC64_ADDR16_HIGHERA:
+  case R_PPC64_ADDR16_HIGHEST:
+  case R_PPC64_ADDR16_HIGHESTA:
+  case R_PPC64_ADDR16_LO:
+  case R_PPC64_ADDR16_LO_DS:
+  case R_PPC64_ADDR32:
+  case R_PPC64_ADDR64:
+    return R_ABS;
   case R_PPC64_GOT16:
   case R_PPC64_GOT16_DS:
   case R_PPC64_GOT16_HA:
@@ -554,6 +569,7 @@ RelExpr PPC64::getRelExpr(RelType type, const Symbol &
     return R_PPC64_CALL_PLT;
   case R_PPC64_REL16_LO:
   case R_PPC64_REL16_HA:
+  case R_PPC64_REL16_HI:
   case R_PPC64_REL32:
   case R_PPC64_REL64:
     return R_PC;
@@ -607,7 +623,9 @@ RelExpr PPC64::getRelExpr(RelType type, const Symbol &
   case R_PPC64_TLS:
     return R_TLSIE_HINT;
   default:
-    return R_ABS;
+    error(getErrorLocation(loc) + "unknown relocation (" + Twine(type) +
+          ") against symbol " + toString(s));
+    return R_NONE;
   }
 }
 
@@ -870,7 +888,7 @@ void PPC64::relocateOne(uint8_t *loc, RelType type, ui
     write64(loc, val - dynamicThreadPointerOffset);
     break;
   default:
-    error(getErrorLocation(loc) + "unrecognized relocation " + toString(type));
+    llvm_unreachable("unknown relocation");
   }
 }
 

Modified: vendor/lld/dist-release_90/ELF/InputFiles.cpp
==============================================================================
--- vendor/lld/dist-release_90/ELF/InputFiles.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/ELF/InputFiles.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -1144,7 +1144,7 @@ void ArchiveFile::fetch(const Archive::Symbol &sym) {
   Archive::Child c =
       CHECK(sym.getMember(), toString(this) +
                                  ": could not get the member for symbol " +
-                                 sym.getName());
+                                 toELFString(sym));
 
   if (!seen.insert(c.getChildOffset()).second)
     return;
@@ -1153,7 +1153,7 @@ void ArchiveFile::fetch(const Archive::Symbol &sym) {
       CHECK(c.getMemoryBufferRef(),
             toString(this) +
                 ": could not get the buffer for the member defining symbol " +
-                sym.getName());
+                toELFString(sym));
 
   if (tar && c.getParent()->isThin())
     tar->append(relativeToRoot(CHECK(c.getFullName(), this)), mb.getBuffer());

Modified: vendor/lld/dist-release_90/ELF/Symbols.cpp
==============================================================================
--- vendor/lld/dist-release_90/ELF/Symbols.cpp	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/ELF/Symbols.cpp	Mon Sep  2 17:49:30 2019	(r351718)
@@ -42,6 +42,20 @@ Defined *ElfSym::relaIpltEnd;
 Defined *ElfSym::riscvGlobalPointer;
 Defined *ElfSym::tlsModuleBase;
 
+// Returns a symbol for an error message.
+static std::string demangle(StringRef symName) {
+  if (config->demangle)
+    if (Optional<std::string> s = demangleItanium(symName))
+      return *s;
+  return symName;
+}
+namespace lld {
+std::string toString(const Symbol &b) { return demangle(b.getName()); }
+std::string toELFString(const Archive::Symbol &b) {
+  return demangle(b.getName());
+}
+} // namespace lld
+
 static uint64_t getSymVA(const Symbol &sym, int64_t &addend) {
   switch (sym.kind()) {
   case Symbol::DefinedKind: {
@@ -250,12 +264,13 @@ void Symbol::fetch() const {
 }
 
 MemoryBufferRef LazyArchive::getMemberBuffer() {
-  Archive::Child c = CHECK(
-      sym.getMember(), "could not get the member for symbol " + sym.getName());
+  Archive::Child c =
+      CHECK(sym.getMember(),
+            "could not get the member for symbol " + toELFString(sym));
 
   return CHECK(c.getMemoryBufferRef(),
                "could not get the buffer for the member defining symbol " +
-                   sym.getName());
+                   toELFString(sym));
 }
 
 uint8_t Symbol::computeBinding() const {
@@ -329,14 +344,6 @@ void elf::maybeWarnUnorderableSymbol(const Symbol *sym
     report(": unable to order synthetic symbol: ");
   else if (d && !d->section->repl->isLive())
     report(": unable to order discarded symbol: ");
-}
-
-// Returns a symbol for an error message.
-std::string lld::toString(const Symbol &b) {
-  if (config->demangle)
-    if (Optional<std::string> s = demangleItanium(b.getName()))
-      return *s;
-  return b.getName();
 }
 
 static uint8_t getMinVisibility(uint8_t va, uint8_t vb) {

Modified: vendor/lld/dist-release_90/ELF/Symbols.h
==============================================================================
--- vendor/lld/dist-release_90/ELF/Symbols.h	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/ELF/Symbols.h	Mon Sep  2 17:49:30 2019	(r351718)
@@ -33,7 +33,11 @@ class Undefined;
 } // namespace elf
 
 std::string toString(const elf::Symbol &);
-std::string toString(const elf::InputFile *);
+
+// There are two different ways to convert an Archive::Symbol to a string:
+// One for Microsoft name mangling and one for Itanium name mangling.
+// Call the functions toCOFFString and toELFString, not just toString.
+std::string toELFString(const elf::Archive::Symbol &);
 
 namespace elf {
 

Modified: vendor/lld/dist-release_90/docs/ReleaseNotes.rst
==============================================================================
--- vendor/lld/dist-release_90/docs/ReleaseNotes.rst	Mon Sep  2 17:49:27 2019	(r351717)
+++ vendor/lld/dist-release_90/docs/ReleaseNotes.rst	Mon Sep  2 17:49:30 2019	(r351718)
@@ -5,11 +5,6 @@ lld 9.0.0 Release Notes
 .. contents::
     :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 9.0.0 release.
-   Release notes for previous releases can be found on
-   `the Download Page <https://releases.llvm.org/download.html>`_.
-
 Introduction
 ============
 
@@ -37,8 +32,6 @@ ELF Improvements
   into corresponding PT_MIPS_REGINFO, PT_MIPS_OPTIONS, and PT_MIPS_ABIFLAGS
   segments.
 
-* ...
-
 COFF Improvements
 -----------------
 
@@ -51,6 +44,12 @@ COFF Improvements
   input files define resources with the same type, name, and language.
   This can be demoted to a warning using ``/force:multipleres``.
 
+* lld-link now rejects more than one resource obj input files, matching
+  link.exe. Previously, lld-link would silently ignore all but one.
+  If you hit this: Don't pass resource obj files to the linker, instead pass
+  res files to the linker directly. Don't put res files in static libraries,
+  pass them on the command line.
+
 * Having more than two ``/natvis:`` now works correctly; it used to not
   work for larger binaries before.
 
@@ -70,8 +69,6 @@ COFF Improvements
 * The generated thunks for delayimports now share the majority of code
   among thunks, significantly reducing the overhead of using delayimport
 
-* ...
-
 MinGW Improvements
 ------------------
 
@@ -89,13 +86,3 @@ MinGW Improvements
   name, with the new option ``-pdb=`` with an empty value to the option.
   (The old existing syntax ``-pdb <filename>`` was more cumbersome to use
   with an empty parameter value.)
-
-MachO Improvements
-------------------
-
-* Item 1.
-
-WebAssembly Improvements
-------------------------
-
-* ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909021749.x82HnU1o020001>