[ELF] Make AtomLayout more accessible.

This is needed to allow constant time access to the final layout of atoms.

llvm-svn: 173874
diff --git a/lld/lib/ReaderWriter/ELF/Writer.cpp b/lld/lib/ReaderWriter/ELF/Writer.cpp
index 2318cd8..6e3bc43 100644
--- a/lld/lib/ReaderWriter/ELF/Writer.cpp
+++ b/lld/lib/ReaderWriter/ELF/Writer.cpp
@@ -97,7 +97,7 @@
   for (auto sec : _layout->sections())
     if (auto section = dyn_cast<Section<ELFT>>(sec))
       for (const auto &atom : section->atoms())
-        _symtab->addSymbol(atom._atom, section->ordinal(), atom._virtualAddr);
+        _symtab->addSymbol(atom->_atom, section->ordinal(), atom->_virtualAddr);
 }
 
 template<class ELFT>
@@ -106,7 +106,7 @@
   // add all the absolute symbols that the layout contains to the output symbol
   // table
   for (auto &atom : _layout->absoluteAtoms())
-    _symtab->addSymbol(atom.absoluteAtom(), ELF::SHN_ABS, atom.value());
+    _symtab->addSymbol(atom->_atom, ELF::SHN_ABS, atom->_virtualAddr);
   for (const UndefinedAtom *a : file.undefined())
     _symtab->addSymbol(a, ELF::SHN_UNDEF);
 }
@@ -116,10 +116,10 @@
   for (auto sec : _layout->sections())
     if (auto section = dyn_cast<Section<ELFT>>(sec))
       for (const auto &atom : section->atoms())
-        _atomToAddressMap[atom._atom] = atom._virtualAddr;
+        _atomToAddressMap[atom->_atom] = atom->_virtualAddr;
   // build the atomToAddressMap that contains absolute symbols too
   for (auto &atom : _layout->absoluteAtoms())
-    _atomToAddressMap[atom.absoluteAtom()] = atom.value();
+    _atomToAddressMap[atom->_atom] = atom->_virtualAddr;
 }
 
 template<class ELFT>
@@ -187,11 +187,11 @@
                       StringRef sec) -> void {
     auto section = _layout->findOutputSection(sec);
     if (section) {
-      start->setValue(section->virtualAddr());
-      end->setValue(section->virtualAddr() + section->memSize());
+      (*start)->_virtualAddr = section->virtualAddr();
+      (*end)->_virtualAddr = section->virtualAddr() + section->memSize();
     } else {
-      start->setValue(0);
-      end->setValue(0);
+      (*start)->_virtualAddr = 0;
+      (*end)->_virtualAddr = 0;
     }
   };
 
@@ -210,10 +210,10 @@
   assert(!(phe == _programHeader->end()) &&
          "Can't find a data segment in the program header!");
 
-  bssStartAtomIter->setValue((*phe)->p_vaddr + (*phe)->p_filesz);
-  bssEndAtomIter->setValue((*phe)->p_vaddr + (*phe)->p_memsz);
-  underScoreEndAtomIter->setValue((*phe)->p_vaddr + (*phe)->p_memsz);
-  endAtomIter->setValue((*phe)->p_vaddr + (*phe)->p_memsz);
+  (*bssStartAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_filesz;
+  (*bssEndAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_memsz;
+  (*underScoreEndAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_memsz;
+  (*endAtomIter)->_virtualAddr = (*phe)->p_vaddr + (*phe)->p_memsz;
 }
 
 template<class ELFT>