Remove BssSection::reserveSpace().

We no longer call reserveSpace more than once, so it can be merged with
its constructor.

llvm-svn: 314867
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 5bd21dd..86d5d5e 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -525,8 +525,8 @@
   // See if this symbol is in a read-only segment. If so, preserve the symbol's
   // memory protection by reserving space in the .bss.rel.ro section.
   bool IsReadOnly = isReadOnly<ELFT>(SS);
-  BssSection *Sec = make<BssSection>(IsReadOnly ? ".bss.rel.ro" : ".bss");
-  Sec->reserveSpace(SymSize, SS->getAlignment<ELFT>());
+  BssSection *Sec = make<BssSection>(IsReadOnly ? ".bss.rel.ro" : ".bss",
+                                     SymSize, SS->getAlignment<ELFT>());
   if (IsReadOnly)
     InX::BssRelRo->getParent()->addSection(Sec);
   else
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 21bd825..a07ac8c 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -67,10 +67,9 @@
       continue;
 
     // Create a synthetic section for the common data.
-    auto *Section = make<BssSection>("COMMON");
+    auto *Section = make<BssSection>("COMMON", Sym->Size, Sym->Alignment);
     Section->File = Sym->getFile();
     Section->Live = !Config->GcSections;
-    Section->reserveSpace(Sym->Size, Sym->Alignment);
     InputSections.push_back(Section);
 
     // Replace all DefinedCommon symbols with DefinedRegular symbols so that we
@@ -361,15 +360,11 @@
   HashFn(HashBuf, Hashes);
 }
 
-BssSection::BssSection(StringRef Name)
-    : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, 0, Name) {}
-
-size_t BssSection::reserveSpace(uint64_t Size, uint32_t Alignment) {
+BssSection::BssSection(StringRef Name, uint64_t Size, uint32_t Alignment)
+    : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_NOBITS, Alignment, Name) {
   if (OutputSection *Sec = getParent())
     Sec->updateAlignment(Alignment);
-  this->Size = alignTo(this->Size, Alignment) + Size;
-  this->Alignment = std::max(this->Alignment, Alignment);
-  return this->Size - Size;
+  this->Size = Size;
 }
 
 void BuildIdSection::writeBuildId(ArrayRef<uint8_t> Buf) {
diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h
index b789cd5..99ad038 100644
--- a/lld/ELF/SyntheticSections.h
+++ b/lld/ELF/SyntheticSections.h
@@ -157,14 +157,13 @@
 // respectively.
 class BssSection final : public SyntheticSection {
 public:
-  BssSection(StringRef Name);
+  BssSection(StringRef Name, uint64_t Size, uint32_t Alignment);
   void writeTo(uint8_t *) override {}
   bool empty() const override { return getSize() == 0; }
-  size_t reserveSpace(uint64_t Size, uint32_t Alignment);
   size_t getSize() const override { return Size; }
 
 private:
-  uint64_t Size = 0;
+  uint64_t Size;
 };
 
 class MipsGotSection final : public SyntheticSection {
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 7deb6b3..3fbe22a 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -290,9 +290,9 @@
     Add(InX::BuildId);
   }
 
-  InX::Bss = make<BssSection>(".bss");
+  InX::Bss = make<BssSection>(".bss", 0, 1);
   Add(InX::Bss);
-  InX::BssRelRo = make<BssSection>(".bss.rel.ro");
+  InX::BssRelRo = make<BssSection>(".bss.rel.ro", 0, 1);
   Add(InX::BssRelRo);
 
   // Add MIPS-specific sections.