<div dir="ltr">LLD ELF can be used as a library, but it is as a whole a single monolithic linker. So is COFF linker. I put this file and make it a "library" to share code between ports, but no one except the two will use it. I'm fine to retract this and instead copy-n-paste this code for now, but we need to fix the directory and library structure to match the reality. It is silly if we cannot code between COFF and ELF.<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 8, 2016 at 9:48 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Please revert this for now. The use of globals in LLD has been acceptable on the premise that these variables are in the "LLD is a program, not a library" part of LLD. Putting globals in a library is another matter and should not be done lightly.<span class="m_4662250962169156980HOEnZb"><font color="#888888"><div><br></div><div>-- Sean Silva</div></font></span></div><div class="m_4662250962169156980HOEnZb"><div class="m_4662250962169156980h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 8, 2016 at 10:31 AM, Rui Ueyama via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ruiu<br>
Date: Thu Dec  8 12:31:13 2016<br>
New Revision: 289084<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289084&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=289084&view=rev</a><br>
Log:<br>
Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.<br>
<br>
Added:<br>
    lld/trunk/include/lld/Support/<br>
    lld/trunk/include/lld/Support/<wbr>Memory.h<br>
      - copied, changed from r289082, lld/trunk/ELF/Memory.h<br>
    lld/trunk/lib/Support/<br>
    lld/trunk/lib/Support/CMakeLis<wbr>ts.txt<br>
    lld/trunk/lib/Support/Memory.c<wbr>pp<br>
      - copied, changed from r289082, lld/trunk/ELF/Memory.cpp<br>
Removed:<br>
    lld/trunk/ELF/Memory.cpp<br>
    lld/trunk/ELF/Memory.h<br>
Modified:<br>
    lld/trunk/ELF/CMakeLists.txt<br>
    lld/trunk/ELF/Driver.cpp<br>
    lld/trunk/ELF/DriverUtils.cpp<br>
    lld/trunk/ELF/InputFiles.cpp<br>
    lld/trunk/ELF/InputSection.cpp<br>
    lld/trunk/ELF/LinkerScript.cpp<br>
    lld/trunk/ELF/OutputSections.c<wbr>pp<br>
    lld/trunk/ELF/SymbolTable.cpp<br>
    lld/trunk/ELF/SyntheticSection<wbr>s.cpp<br>
    lld/trunk/ELF/Target.cpp<br>
    lld/trunk/ELF/Thunks.cpp<br>
    lld/trunk/ELF/Writer.cpp<br>
    lld/trunk/lib/CMakeLists.txt<br>
<br>
Modified: lld/trunk/ELF/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/CMakeLists.txt?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/CMakeLists<wbr>.txt?rev=289084&r1=289083&r2=2<wbr>89084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/CMakeLists.txt (original)<br>
+++ lld/trunk/ELF/CMakeLists.txt Thu Dec  8 12:31:13 2016<br>
@@ -14,7 +14,6 @@ add_lld_library(lldELF<br>
   LTO.cpp<br>
   LinkerScript.cpp<br>
   MarkLive.cpp<br>
-  Memory.cpp<br>
   Mips.cpp<br>
   OutputSections.cpp<br>
   Relocations.cpp<br>
@@ -50,6 +49,7 @@ add_lld_library(lldELF<br>
   LINK_LIBS<br>
   lldConfig<br>
   lldCore<br>
+  lldSupport<br>
   ${PTHREAD_LIB}<br>
<br>
   DEPENDS<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Driver.cpp<wbr>?rev=289084&r1=289083&r2=28908<wbr>4&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Thu Dec  8 12:31:13 2016<br>
@@ -14,7 +14,6 @@<br>
 #include "InputFiles.h"<br>
 #include "InputSection.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "Strings.h"<br>
 #include "SymbolTable.h"<br>
 #include "Target.h"<br>
@@ -22,6 +21,7 @@<br>
 #include "Writer.h"<br>
 #include "lld/Config/Version.h"<br>
 #include "lld/Driver/Driver.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/StringExtras.h"<br>
 #include "llvm/ADT/StringSwitch.h"<br>
 #include "llvm/Support/CommandLine.h"<br>
<br>
Modified: lld/trunk/ELF/DriverUtils.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/DriverUtil<wbr>s.cpp?rev=289084&r1=289083&r2=<wbr>289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/DriverUtils.cpp (original)<br>
+++ lld/trunk/ELF/DriverUtils.cpp Thu Dec  8 12:31:13 2016<br>
@@ -15,10 +15,10 @@<br>
<br>
 #include "Driver.h"<br>
 #include "Error.h"<br>
-#include "Memory.h"<br>
 #include "ScriptParser.h"<br>
 #include "lld/Config/Version.h"<br>
 #include "lld/Core/Reproduce.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/Optional.h"<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/ADT/Triple.h"<br>
<br>
Modified: lld/trunk/ELF/InputFiles.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/InputFiles<wbr>.cpp?rev=289084&r1=289083&r2=2<wbr>89084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputFiles.cpp (original)<br>
+++ lld/trunk/ELF/InputFiles.cpp Thu Dec  8 12:31:13 2016<br>
@@ -12,9 +12,9 @@<br>
 #include "Error.h"<br>
 #include "InputSection.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "SymbolTable.h"<br>
 #include "Symbols.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/Bitcode/BitcodeReader.h"<br>
 #include "llvm/CodeGen/Analysis.h"<br>
<br>
Modified: lld/trunk/ELF/InputSection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/InputSecti<wbr>on.cpp?rev=289084&r1=289083&r2<wbr>=289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.cpp (original)<br>
+++ lld/trunk/ELF/InputSection.cpp Thu Dec  8 12:31:13 2016<br>
@@ -13,13 +13,12 @@<br>
 #include "Error.h"<br>
 #include "InputFiles.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "OutputSections.h"<br>
 #include "Relocations.h"<br>
 #include "SyntheticSections.h"<br>
 #include "Target.h"<br>
 #include "Thunks.h"<br>
-<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/Support/Compression.h"<br>
 #include "llvm/Support/Endian.h"<br>
 #include <mutex><br>
<br>
Modified: lld/trunk/ELF/LinkerScript.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/LinkerScri<wbr>pt.cpp?rev=289084&r1=289083&r2<wbr>=289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/LinkerScript.cpp (original)<br>
+++ lld/trunk/ELF/LinkerScript.cpp Thu Dec  8 12:31:13 2016<br>
@@ -15,7 +15,6 @@<br>
 #include "Config.h"<br>
 #include "Driver.h"<br>
 #include "InputSection.h"<br>
-#include "Memory.h"<br>
 #include "OutputSections.h"<br>
 #include "ScriptParser.h"<br>
 #include "Strings.h"<br>
@@ -24,6 +23,7 @@<br>
 #include "SyntheticSections.h"<br>
 #include "Target.h"<br>
 #include "Writer.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/ADT/SmallString.h"<br>
 #include "llvm/ADT/StringRef.h"<br>
<br>
Removed: lld/trunk/ELF/Memory.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Memory.cpp?rev=289083&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Memory.cpp<wbr>?rev=289083&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Memory.cpp (original)<br>
+++ lld/trunk/ELF/Memory.cpp (removed)<br>
@@ -1,29 +0,0 @@<br>
-//===- Memory.cpp ------------------------------<wbr>-----------------*- C++ -*-===//<br>
-//<br>
-//                             The LLVM Linker<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
-<br>
-#include "Memory.h"<br>
-<br>
-using namespace llvm;<br>
-using namespace lld;<br>
-using namespace lld::elf;<br>
-<br>
-namespace lld {<br>
-BumpPtrAllocator elf::BAlloc;<br>
-StringSaver elf::Saver{elf::BAlloc};<br>
-<br>
-SpecificAllocBase::SpecificAl<wbr>locBase() { Instances.push_back(this); }<br>
-<br>
-std::vector<SpecificAllocBase *> SpecificAllocBase::Instances;<br>
-<br>
-void elf::freeArena() {<br>
-  for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)<br>
-    Alloc->reset();<br>
-  BAlloc.Reset();<br>
-}<br>
-}<br>
<br>
Removed: lld/trunk/ELF/Memory.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Memory.h?rev=289083&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Memory.h?r<wbr>ev=289083&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Memory.h (original)<br>
+++ lld/trunk/ELF/Memory.h (removed)<br>
@@ -1,61 +0,0 @@<br>
-//===- Memory.h ------------------------------<wbr>-------------------*- C++ -*-===//<br>
-//<br>
-//                             The LLVM Linker<br>
-//<br>
-// This file is distributed under the University of Illinois Open Source<br>
-// License. See LICENSE.TXT for details.<br>
-//<br>
-//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
-//<br>
-// This file defines arena allocators.<br>
-//<br>
-// Almost all large objects, such as files, sections or symbols, are<br>
-// used for the entire lifetime of the linker once they are created.<br>
-// This usage characteristic makes arena allocator an attractive choice<br>
-// where the entire linker is one arena. With an arena, newly created<br>
-// objects belong to the arena and freed all at once when everything is done.<br>
-// Arena allocators are efficient and easy to understand.<br>
-// Most objects are allocated using the arena allocators defined by this file.<br>
-//<br>
-//===------------------------<wbr>------------------------------<wbr>----------------===//<br>
-<br>
-#ifndef LLD_ELF_MEMORY_H<br>
-#define LLD_ELF_MEMORY_H<br>
-<br>
-#include "llvm/Support/Allocator.h"<br>
-#include "llvm/Support/StringSaver.h"<br>
-#include <vector><br>
-<br>
-namespace lld {<br>
-namespace elf {<br>
-<br>
-// Use this arena if your object doesn't have a destructor.<br>
-extern llvm::BumpPtrAllocator BAlloc;<br>
-extern llvm::StringSaver Saver;<br>
-<br>
-// These two classes are hack to keep track of all<br>
-// SpecificBumpPtrAllocator instances.<br>
-struct SpecificAllocBase {<br>
-  SpecificAllocBase();<br>
-  virtual ~SpecificAllocBase() = default;<br>
-  virtual void reset() = 0;<br>
-  static std::vector<SpecificAllocBase *> Instances;<br>
-};<br>
-<br>
-template <class T> struct SpecificAlloc : public SpecificAllocBase {<br>
-  void reset() override { Alloc.DestroyAll(); }<br>
-  llvm::SpecificBumpPtrAllocator<wbr><T> Alloc;<br>
-};<br>
-<br>
-// Use this arena if your object has a destructor.<br>
-// Your destructor will be invoked from freeArena().<br>
-template <typename T, typename... U> inline T *make(U &&... Args) {<br>
-  static SpecificAlloc<T> Alloc;<br>
-  return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);<br>
-}<br>
-<br>
-void freeArena();<br>
-}<br>
-}<br>
-<br>
-#endif<br>
<br>
Modified: lld/trunk/ELF/OutputSections.c<wbr>pp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/OutputSect<wbr>ions.cpp?rev=289084&r1=289083&<wbr>r2=289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/OutputSections.c<wbr>pp (original)<br>
+++ lld/trunk/ELF/OutputSections.c<wbr>pp Thu Dec  8 12:31:13 2016<br>
@@ -11,12 +11,12 @@<br>
 #include "Config.h"<br>
 #include "EhFrame.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "Strings.h"<br>
 #include "SymbolTable.h"<br>
 #include "SyntheticSections.h"<br>
 #include "Target.h"<br>
 #include "Threads.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/Support/Dwarf.h"<br>
 #include "llvm/Support/MD5.h"<br>
 #include "llvm/Support/MathExtras.h"<br>
<br>
Modified: lld/trunk/ELF/SymbolTable.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/SymbolTabl<wbr>e.cpp?rev=289084&r1=289083&r2=<wbr>289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/SymbolTable.cpp (original)<br>
+++ lld/trunk/ELF/SymbolTable.cpp Thu Dec  8 12:31:13 2016<br>
@@ -18,8 +18,8 @@<br>
 #include "Config.h"<br>
 #include "Error.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "Symbols.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/STLExtras.h"<br>
<br>
 using namespace llvm;<br>
<br>
Modified: lld/trunk/ELF/SyntheticSection<wbr>s.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/SyntheticS<wbr>ections.cpp?rev=289084&r1=2890<wbr>83&r2=289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/SyntheticSection<wbr>s.cpp (original)<br>
+++ lld/trunk/ELF/SyntheticSection<wbr>s.cpp Thu Dec  8 12:31:13 2016<br>
@@ -19,15 +19,14 @@<br>
 #include "Error.h"<br>
 #include "InputFiles.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "OutputSections.h"<br>
 #include "Strings.h"<br>
 #include "SymbolTable.h"<br>
 #include "Target.h"<br>
 #include "Threads.h"<br>
 #include "Writer.h"<br>
-<br>
 #include "lld/Config/Version.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/Support/Dwarf.h"<br>
 #include "llvm/Support/Endian.h"<br>
 #include "llvm/Support/MD5.h"<br>
<br>
Modified: lld/trunk/ELF/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Target.cpp<wbr>?rev=289084&r1=289083&r2=28908<wbr>4&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Target.cpp (original)<br>
+++ lld/trunk/ELF/Target.cpp Thu Dec  8 12:31:13 2016<br>
@@ -27,17 +27,16 @@<br>
 #include "Target.h"<br>
 #include "Error.h"<br>
 #include "InputFiles.h"<br>
-#include "Memory.h"<br>
 #include "OutputSections.h"<br>
 #include "Symbols.h"<br>
 #include "SyntheticSections.h"<br>
 #include "Thunks.h"<br>
 #include "Writer.h"<br>
-<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/ArrayRef.h"<br>
 #include "llvm/Object/ELF.h"<br>
-#include "llvm/Support/Endian.h"<br>
 #include "llvm/Support/ELF.h"<br>
+#include "llvm/Support/Endian.h"<br>
<br>
 using namespace llvm;<br>
 using namespace llvm::object;<br>
<br>
Modified: lld/trunk/ELF/Thunks.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Thunks.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Thunks.cpp<wbr>?rev=289084&r1=289083&r2=28908<wbr>4&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Thunks.cpp (original)<br>
+++ lld/trunk/ELF/Thunks.cpp Thu Dec  8 12:31:13 2016<br>
@@ -25,10 +25,10 @@<br>
 #include "Config.h"<br>
 #include "Error.h"<br>
 #include "InputSection.h"<br>
-#include "Memory.h"<br>
 #include "OutputSections.h"<br>
 #include "Symbols.h"<br>
 #include "Target.h"<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/Support/Casting.h"<br>
 #include "llvm/Support/ELF.h"<br>
 #include "llvm/Support/Endian.h"<br>
<br>
Modified: lld/trunk/ELF/Writer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Writer.cpp<wbr>?rev=289084&r1=289083&r2=28908<wbr>4&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Writer.cpp (original)<br>
+++ lld/trunk/ELF/Writer.cpp Thu Dec  8 12:31:13 2016<br>
@@ -10,14 +10,13 @@<br>
 #include "Writer.h"<br>
 #include "Config.h"<br>
 #include "LinkerScript.h"<br>
-#include "Memory.h"<br>
 #include "OutputSections.h"<br>
 #include "Relocations.h"<br>
 #include "Strings.h"<br>
 #include "SymbolTable.h"<br>
 #include "SyntheticSections.h"<br>
 #include "Target.h"<br>
-<br>
+#include "lld/Support/Memory.h"<br>
 #include "llvm/ADT/StringMap.h"<br>
 #include "llvm/ADT/StringSwitch.h"<br>
 #include "llvm/Support/FileOutputBuffer<wbr>.h"<br>
<br>
Copied: lld/trunk/include/lld/Support/<wbr>Memory.h (from r289082, lld/trunk/ELF/Memory.h)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Support/Memory.h?p2=lld/trunk/include/lld/Support/Memory.h&p1=lld/trunk/ELF/Memory.h&r1=289082&r2=289084&rev=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/include/lld/Su<wbr>pport/Memory.h?p2=lld/trunk/in<wbr>clude/lld/Support/Memory.h&p1=<wbr>lld/trunk/ELF/Memory.h&r1=2890<wbr>82&r2=289084&rev=289084&view=d<wbr>iff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Memory.h (original)<br>
+++ lld/trunk/include/lld/Support/<wbr>Memory.h Thu Dec  8 12:31:13 2016<br>
@@ -19,15 +19,14 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
<br>
-#ifndef LLD_ELF_MEMORY_H<br>
-#define LLD_ELF_MEMORY_H<br>
+#ifndef LLD_MEMORY_H<br>
+#define LLD_MEMORY_H<br>
<br>
 #include "llvm/Support/Allocator.h"<br>
 #include "llvm/Support/StringSaver.h"<br>
 #include <vector><br>
<br>
 namespace lld {<br>
-namespace elf {<br>
<br>
 // Use this arena if your object doesn't have a destructor.<br>
 extern llvm::BumpPtrAllocator BAlloc;<br>
@@ -56,6 +55,5 @@ template <typename T, typename... U> inl<br>
<br>
 void freeArena();<br>
 }<br>
-}<br>
<br>
 #endif<br>
<br>
Modified: lld/trunk/lib/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/CMakeLists.txt?rev=289084&r1=289083&r2=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/lib/CMakeLists<wbr>.txt?rev=289084&r1=289083&r2=2<wbr>89084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/lib/CMakeLists.txt (original)<br>
+++ lld/trunk/lib/CMakeLists.txt Thu Dec  8 12:31:13 2016<br>
@@ -2,3 +2,4 @@ add_subdirectory(Config)<br>
 add_subdirectory(Core)<br>
 add_subdirectory(Driver)<br>
 add_subdirectory(ReaderWriter<wbr>)<br>
+add_subdirectory(Support)<br>
<br>
Added: lld/trunk/lib/Support/CMakeLis<wbr>ts.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Support/CMakeLists.txt?rev=289084&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/lib/Support/CM<wbr>akeLists.txt?rev=289084&view=a<wbr>uto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/lib/Support/CMakeLis<wbr>ts.txt (added)<br>
+++ lld/trunk/lib/Support/CMakeLis<wbr>ts.txt Thu Dec  8 12:31:13 2016<br>
@@ -0,0 +1,9 @@<br>
+add_lld_library(lldSupport<br>
+  Memory.cpp<br>
+<br>
+  ADDITIONAL_HEADER_DIRS<br>
+  ${LLD_INCLUDE_DIR}/lld/Support<br>
+<br>
+  LINK_LIBS<br>
+  LLVMSupport<br>
+)<br>
<br>
Copied: lld/trunk/lib/Support/Memory.c<wbr>pp (from r289082, lld/trunk/ELF/Memory.cpp)<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Support/Memory.cpp?p2=lld/trunk/lib/Support/Memory.cpp&p1=lld/trunk/ELF/Memory.cpp&r1=289082&r2=289084&rev=289084&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/lib/Support/Me<wbr>mory.cpp?p2=lld/trunk/lib/Supp<wbr>ort/Memory.cpp&p1=lld/trunk/EL<wbr>F/Memory.cpp&r1=289082&r2=2890<wbr>84&rev=289084&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Memory.cpp (original)<br>
+++ lld/trunk/lib/Support/Memory.c<wbr>pp Thu Dec  8 12:31:13 2016<br>
@@ -7,21 +7,19 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<br>
<br>
-#include "Memory.h"<br>
+#include "lld/Support/Memory.h"<br>
<br>
 using namespace llvm;<br>
-using namespace lld;<br>
-using namespace lld::elf;<br>
<br>
 namespace lld {<br>
-BumpPtrAllocator elf::BAlloc;<br>
-StringSaver elf::Saver{elf::BAlloc};<br>
+BumpPtrAllocator BAlloc;<br>
+StringSaver Saver{BAlloc};<br>
<br>
 SpecificAllocBase::SpecificAl<wbr>locBase() { Instances.push_back(this); }<br>
<br>
 std::vector<SpecificAllocBase *> SpecificAllocBase::Instances;<br>
<br>
-void elf::freeArena() {<br>
+void freeArena() {<br>
   for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)<br>
     Alloc->reset();<br>
   BAlloc.Reset();<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>