MC: Clean up method names in MCContext.
[oota-llvm.git] / lib / MC / ELFObjectWriter.cpp
index 0fea46c0572f74e3a5fb9a3d8192cff839484909..9f87cd1f183aed13748daa73426e6bc20399ecad 100644 (file)
@@ -132,6 +132,9 @@ class ELFObjectWriter : public MCObjectWriter {
 
     unsigned ShstrtabIndex;
 
+    // Sections in the order they are to be output in the section table.
+    std::vector<const MCSectionELF *> SectionTable;
+    unsigned addToSectionTable(const MCSectionELF *Sec);
 
     // TargetObjectWriter wrappers.
     bool is64Bit() const { return TargetObjectWriter->is64Bit(); }
@@ -160,6 +163,8 @@ class ELFObjectWriter : public MCObjectWriter {
       LocalSymbolData.clear();
       ExternalSymbolData.clear();
       UndefinedSymbolData.clear();
+      NeedsGOT = false;
+      SectionTable.clear();
       MCObjectWriter::reset();
     }
 
@@ -179,8 +184,6 @@ class ELFObjectWriter : public MCObjectWriter {
         support::endian::Writer<support::big>(OS).write(Val);
     }
 
-    template <typename T> void write(MCDataFragment &F, T Value);
-
     void writeHeader(const MCAssembler &Asm);
 
     void WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,
@@ -191,7 +194,6 @@ class ELFObjectWriter : public MCObjectWriter {
         SectionOffsetsTy;
 
     void WriteSymbolTable(MCAssembler &Asm, const MCAsmLayout &Layout,
-                          std::vector<const MCSectionELF *> &Sections,
                           SectionOffsetsTy &SectionOffsets);
 
     bool shouldRelocateWithSymbol(const MCAssembler &Asm,
@@ -222,36 +224,31 @@ class ELFObjectWriter : public MCObjectWriter {
     const MCSectionELF *createRelocationSection(MCAssembler &Asm,
                                                 const MCSectionELF &Sec);
 
-    void CompressDebugSections(MCAssembler &Asm, MCAsmLayout &Layout);
-
-    const MCSectionELF *
-    createSectionHeaderStringTable(MCAssembler &Asm,
-                                   std::vector<const MCSectionELF *> &Sections);
-    const MCSectionELF *
-    createStringTable(MCAssembler &Asm,
-                      std::vector<const MCSectionELF *> &Sections);
+    const MCSectionELF *createSectionHeaderStringTable();
+    const MCSectionELF *createStringTable(MCContext &Ctx);
 
     void ExecutePostLayoutBinding(MCAssembler &Asm,
                                   const MCAsmLayout &Layout) override;
 
-    void writeSectionHeader(ArrayRef<const MCSectionELF *> Sections,
-                            MCAssembler &Asm, const MCAsmLayout &Layout,
+    void writeSectionHeader(MCAssembler &Asm, const MCAsmLayout &Layout,
                             const SectionIndexMapTy &SectionIndexMap,
                             const SectionOffsetsTy &SectionOffsets);
 
+    void writeSectionData(const MCAssembler &Asm, const MCSectionData &SD,
+                          const MCAsmLayout &Layout);
+
     void WriteSecHdrEntry(uint32_t Name, uint32_t Type, uint64_t Flags,
-                          uint64_t Address, uint64_t Offset,
-                          uint64_t Size, uint32_t Link, uint32_t Info,
-                          uint64_t Alignment, uint64_t EntrySize);
+                          uint64_t Address, uint64_t Offset, uint64_t Size,
+                          uint32_t Link, uint32_t Info, uint64_t Alignment,
+                          uint64_t EntrySize);
 
     void writeRelocations(const MCAssembler &Asm, const MCSectionELF &Sec);
 
-    bool
-    IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
-                                           const MCSymbolData &DataA,
-                                           const MCFragment &FB,
-                                           bool InSet,
-                                           bool IsPCRel) const override;
+    bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
+                                                const MCSymbol &SymA,
+                                                const MCFragment &FB,
+                                                bool InSet,
+                                                bool IsPCRel) const override;
 
     bool isWeak(const MCSymbolData &SD) const override;
 
@@ -264,13 +261,10 @@ class ELFObjectWriter : public MCObjectWriter {
   };
 }
 
-template <typename T> void ELFObjectWriter::write(MCDataFragment &F, T Val) {
-  if (IsLittleEndian)
-    Val = support::endian::byte_swap<T, support::little>(Val);
-  else
-    Val = support::endian::byte_swap<T, support::big>(Val);
-  const char *Start = (const char *)&Val;
-  F.getContents().append(Start, Start + sizeof(T));
+unsigned ELFObjectWriter::addToSectionTable(const MCSectionELF *Sec) {
+  SectionTable.push_back(Sec);
+  ShStrTabBuilder.add(Sec->getSectionName());
+  return SectionTable.size();
 }
 
 void SymbolTableWriter::createSymtabShndx() {
@@ -427,8 +421,8 @@ void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
   // The presence of symbol versions causes undefined symbols and
   // versions declared with @@@ to be renamed.
 
-  for (MCSymbolData &OriginalData : Asm.symbols()) {
-    const MCSymbol &Alias = OriginalData.getSymbol();
+  for (const MCSymbol &Alias : Asm.symbols()) {
+    MCSymbolData &OriginalData = Alias.getData();
 
     // Not an alias.
     if (!Alias.isVariable())
@@ -545,10 +539,9 @@ void ELFObjectWriter::WriteSymbol(SymbolTableWriter &Writer, ELFSymbolData &MSD,
                      MSD.SectionIndex, IsReserved);
 }
 
-void ELFObjectWriter::WriteSymbolTable(
-    MCAssembler &Asm, const MCAsmLayout &Layout,
-    std::vector<const MCSectionELF *> &Sections,
-    SectionOffsetsTy &SectionOffsets) {
+void ELFObjectWriter::WriteSymbolTable(MCAssembler &Asm,
+                                       const MCAsmLayout &Layout,
+                                       SectionOffsetsTy &SectionOffsets) {
 
   MCContext &Ctx = Asm.getContext();
 
@@ -559,8 +552,7 @@ void ELFObjectWriter::WriteSymbolTable(
       Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, EntrySize, "");
   MCSectionData &SymtabSD = Asm.getOrCreateSectionData(*SymtabSection);
   SymtabSD.setAlignment(is64Bit() ? 8 : 4);
-  SymbolTableIndex = Sections.size() + 1;
-  Sections.push_back(SymtabSection);
+  SymbolTableIndex = addToSectionTable(SymtabSection);
 
   // The string table must be emitted first because we need the index
   // into the string table for all the symbol names.
@@ -617,7 +609,7 @@ void ELFObjectWriter::WriteSymbolTable(
   SecStart = OS.tell();
   const MCSectionELF *SymtabShndxSection =
       Ctx.getELFSection(".symtab_shndxr", ELF::SHT_SYMTAB_SHNDX, 0, 4, "");
-  Sections.push_back(SymtabShndxSection);
+  addToSectionTable(SymtabShndxSection);
   MCSectionData *SymtabShndxSD =
       &Asm.getOrCreateSectionData(*SymtabShndxSection);
   SymtabShndxSD->setAlignment(4);
@@ -790,14 +782,14 @@ void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,
     // or (A + C - R). If B = R + K and the relocation is not pcrel, we can
     // replace B to implement it: (A - R - K + C)
     if (IsPCRel)
-      Asm.getContext().FatalError(
+      Asm.getContext().reportFatalError(
           Fixup.getLoc(),
           "No relocation available to represent this relative expression");
 
     const MCSymbol &SymB = RefB->getSymbol();
 
     if (SymB.isUndefined())
-      Asm.getContext().FatalError(
+      Asm.getContext().reportFatalError(
           Fixup.getLoc(),
           Twine("symbol '") + SymB.getName() +
               "' can not be undefined in a subtraction expression");
@@ -805,12 +797,12 @@ void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,
     assert(!SymB.isAbsolute() && "Should have been folded");
     const MCSection &SecB = SymB.getSection();
     if (&SecB != &FixupSection)
-      Asm.getContext().FatalError(
+      Asm.getContext().reportFatalError(
           Fixup.getLoc(), "Cannot represent a difference across sections");
 
     const MCSymbolData &SymBD = Asm.getSymbolData(SymB);
     if (::isWeak(SymBD))
-      Asm.getContext().FatalError(
+      Asm.getContext().reportFatalError(
           Fixup.getLoc(), "Cannot represent a subtraction with a weak symbol");
 
     uint64_t SymBOffset = Layout.getSymbolOffset(&SymBD);
@@ -936,15 +928,15 @@ void ELFObjectWriter::computeSymbolTable(
   // FIXME: Why is an undefined reference to _GLOBAL_OFFSET_TABLE_ needed?
   if (NeedsGOT) {
     StringRef Name = "_GLOBAL_OFFSET_TABLE_";
-    MCSymbol *Sym = Asm.getContext().GetOrCreateSymbol(Name);
+    MCSymbol *Sym = Asm.getContext().getOrCreateSymbol(Name);
     MCSymbolData &Data = Asm.getOrCreateSymbolData(*Sym);
     Data.setExternal(true);
     MCELF::SetBinding(Data, ELF::STB_GLOBAL);
   }
 
   // Add the data for the symbols.
-  for (MCSymbolData &SD : Asm.symbols()) {
-    const MCSymbol &Symbol = SD.getSymbol();
+  for (const MCSymbol &Symbol : Asm.symbols()) {
+    MCSymbolData &SD = Symbol.getData();
 
     bool Used = UsedInReloc.count(&Symbol);
     bool WeakrefUsed = WeakrefUsedInReloc.count(&Symbol);
@@ -1104,7 +1096,7 @@ ELFObjectWriter::createRelocationSection(MCAssembler &Asm,
 
 static SmallVector<char, 128>
 getUncompressedData(const MCAsmLayout &Layout,
-                    MCSectionData::FragmentListType &Fragments) {
+                    const MCSectionData::FragmentListType &Fragments) {
   SmallVector<char, 128> UncompressedData;
   for (const MCFragment &F : Fragments) {
     const SmallVectorImpl<char> *Contents;
@@ -1147,104 +1139,43 @@ prependCompressionHeader(uint64_t Size,
   return true;
 }
 
-// Return a single fragment containing the compressed contents of the whole
-// section. Null if the section was not compressed for any reason.
-static std::unique_ptr<MCDataFragment>
-getCompressedFragment(const MCAsmLayout &Layout,
-                      MCSectionData::FragmentListType &Fragments) {
-  std::unique_ptr<MCDataFragment> CompressedFragment(new MCDataFragment());
+void ELFObjectWriter::writeSectionData(const MCAssembler &Asm,
+                                       const MCSectionData &SD,
+                                       const MCAsmLayout &Layout) {
+  const MCSectionELF &Section =
+      static_cast<const MCSectionELF &>(SD.getSection());
+  StringRef SectionName = Section.getSectionName();
 
-  // Gather the uncompressed data from all the fragments, recording the
-  // alignment fragment, if seen, and any fixups.
+  // Compressing debug_frame requires handling alignment fragments which is
+  // more work (possibly generalizing MCAssembler.cpp:writeFragment to allow
+  // for writing to arbitrary buffers) for little benefit.
+  if (!Asm.getContext().getAsmInfo()->compressDebugSections() ||
+      !SectionName.startswith(".debug_") || SectionName == ".debug_frame") {
+    Asm.writeSectionData(&SD, Layout);
+    return;
+  }
+
+  // Gather the uncompressed data from all the fragments.
+  const MCSectionData::FragmentListType &Fragments = SD.getFragmentList();
   SmallVector<char, 128> UncompressedData =
       getUncompressedData(Layout, Fragments);
 
-  SmallVectorImpl<char> &CompressedContents = CompressedFragment->getContents();
-
+  SmallVector<char, 128> CompressedContents;
   zlib::Status Success = zlib::compress(
       StringRef(UncompressedData.data(), UncompressedData.size()),
       CompressedContents);
-  if (Success != zlib::StatusOK)
-    return nullptr;
-
-  if (!prependCompressionHeader(UncompressedData.size(), CompressedContents))
-    return nullptr;
-
-  return CompressedFragment;
-}
-
-typedef DenseMap<const MCSectionData *, std::vector<MCSymbolData *>>
-DefiningSymbolMap;
-
-static void UpdateSymbols(const MCAsmLayout &Layout,
-                          const std::vector<MCSymbolData *> &Symbols,
-                          MCFragment &NewFragment) {
-  for (MCSymbolData *Sym : Symbols) {
-    Sym->setOffset(Sym->getOffset() +
-                   Layout.getFragmentOffset(Sym->getFragment()));
-    Sym->setFragment(&NewFragment);
+  if (Success != zlib::StatusOK) {
+    Asm.writeSectionData(&SD, Layout);
+    return;
   }
-}
 
-static void CompressDebugSection(MCAssembler &Asm, MCAsmLayout &Layout,
-                                 const DefiningSymbolMap &DefiningSymbols,
-                                 const MCSectionELF &Section,
-                                 MCSectionData &SD) {
-  StringRef SectionName = Section.getSectionName();
-  MCSectionData::FragmentListType &Fragments = SD.getFragmentList();
-
-  std::unique_ptr<MCDataFragment> CompressedFragment =
-      getCompressedFragment(Layout, Fragments);
-
-  // Leave the section as-is if the fragments could not be compressed.
-  if (!CompressedFragment)
+  if (!prependCompressionHeader(UncompressedData.size(), CompressedContents)) {
+    Asm.writeSectionData(&SD, Layout);
     return;
-
-  // Update the fragment+offsets of any symbols referring to fragments in this
-  // section to refer to the new fragment.
-  auto I = DefiningSymbols.find(&SD);
-  if (I != DefiningSymbols.end())
-    UpdateSymbols(Layout, I->second, *CompressedFragment);
-
-  // Invalidate the layout for the whole section since it will have new and
-  // different fragments now.
-  Layout.invalidateFragmentsFrom(&Fragments.front());
-  Fragments.clear();
-
-  // Complete the initialization of the new fragment
-  CompressedFragment->setParent(&SD);
-  CompressedFragment->setLayoutOrder(0);
-  Fragments.push_back(CompressedFragment.release());
-
-  // Rename from .debug_* to .zdebug_*
+  }
   Asm.getContext().renameELFSection(&Section,
                                     (".z" + SectionName.drop_front(1)).str());
-}
-
-void ELFObjectWriter::CompressDebugSections(MCAssembler &Asm,
-                                            MCAsmLayout &Layout) {
-  if (!Asm.getContext().getAsmInfo()->compressDebugSections())
-    return;
-
-  DefiningSymbolMap DefiningSymbols;
-
-  for (MCSymbolData &SD : Asm.symbols())
-    if (MCFragment *F = SD.getFragment())
-      DefiningSymbols[F->getParent()].push_back(&SD);
-
-  for (MCSectionData &SD : Asm) {
-    const MCSectionELF &Section =
-        static_cast<const MCSectionELF &>(SD.getSection());
-    StringRef SectionName = Section.getSectionName();
-
-    // Compressing debug_frame requires handling alignment fragments which is
-    // more work (possibly generalizing MCAssembler.cpp:writeFragment to allow
-    // for writing to arbitrary buffers) for little benefit.
-    if (!SectionName.startswith(".debug_") || SectionName == ".debug_frame")
-      continue;
-
-    CompressDebugSection(Asm, Layout, DefiningSymbols, Section, SD);
-  }
+  OS << CompressedContents;
 }
 
 void ELFObjectWriter::WriteSecHdrEntry(uint32_t Name, uint32_t Type,
@@ -1307,30 +1238,17 @@ void ELFObjectWriter::writeRelocations(const MCAssembler &Asm,
   }
 }
 
-const MCSectionELF *ELFObjectWriter::createSectionHeaderStringTable(
-    MCAssembler &Asm, std::vector<const MCSectionELF *> &Sections) {
-  const MCSectionELF *ShstrtabSection = Sections[ShstrtabIndex - 1];
-
-  Asm.getOrCreateSectionData(*ShstrtabSection);
-
-  for (MCSectionData &SD : Asm) {
-    const MCSectionELF &Section =
-        static_cast<const MCSectionELF &>(SD.getSection());
-    ShStrTabBuilder.add(Section.getSectionName());
-  }
+const MCSectionELF *ELFObjectWriter::createSectionHeaderStringTable() {
+  const MCSectionELF *ShstrtabSection = SectionTable[ShstrtabIndex - 1];
   ShStrTabBuilder.finalize(StringTableBuilder::ELF);
   OS << ShStrTabBuilder.data();
   return ShstrtabSection;
 }
 
-const MCSectionELF *ELFObjectWriter::createStringTable(
-    MCAssembler &Asm, std::vector<const MCSectionELF *> &Sections) {
-  MCContext &Ctx = Asm.getContext();
+const MCSectionELF *ELFObjectWriter::createStringTable(MCContext &Ctx) {
   const MCSectionELF *StrtabSection =
       Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0);
-  Asm.getOrCreateSectionData(*StrtabSection);
-  Sections.push_back(StrtabSection);
-  StringTableIndex = Sections.size();
+  StringTableIndex = addToSectionTable(StrtabSection);
   OS << StrTabBuilder.data();
   return StrtabSection;
 }
@@ -1350,8 +1268,7 @@ void ELFObjectWriter::writeSection(MCAssembler &Asm,
     break;
 
   case ELF::SHT_DYNAMIC:
-    sh_link = ShStrTabBuilder.getOffset(Section.getSectionName());
-    break;
+    llvm_unreachable("SHT_DYNAMIC in a relocatable object");
 
   case ELF::SHT_REL:
   case ELF::SHT_RELA: {
@@ -1389,46 +1306,41 @@ void ELFObjectWriter::writeSection(MCAssembler &Asm,
 }
 
 void ELFObjectWriter::writeSectionHeader(
-    ArrayRef<const MCSectionELF *> Sections, MCAssembler &Asm,
-    const MCAsmLayout &Layout, const SectionIndexMapTy &SectionIndexMap,
+    MCAssembler &Asm, const MCAsmLayout &Layout,
+    const SectionIndexMapTy &SectionIndexMap,
     const SectionOffsetsTy &SectionOffsets) {
-  const unsigned NumSections = Asm.size();
+  const unsigned NumSections = SectionTable.size();
 
   // Null section first.
   uint64_t FirstSectionSize =
       (NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
   WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, 0, 0);
 
-  for (unsigned i = 0; i < NumSections; ++i) {
-    const MCSectionELF &Section = *Sections[i];
-    const MCSectionData &SD = Asm.getOrCreateSectionData(Section);
+  for (const MCSectionELF *Section : SectionTable) {
+    const MCSectionData &SD = Asm.getOrCreateSectionData(*Section);
     uint32_t GroupSymbolIndex;
-    if (Section.getType() != ELF::SHT_GROUP)
+    unsigned Type = Section->getType();
+    if (Type != ELF::SHT_GROUP)
       GroupSymbolIndex = 0;
     else
-      GroupSymbolIndex = getSymbolIndexInSymbolTable(Asm, Section.getGroup());
+      GroupSymbolIndex = getSymbolIndexInSymbolTable(Asm, Section->getGroup());
 
     const std::pair<uint64_t, uint64_t> &Offsets =
-        SectionOffsets.find(&Section)->second;
-    uint64_t Size = Section.getType() == ELF::SHT_NOBITS
-                        ? Layout.getSectionAddressSize(&SD)
-                        : Offsets.second - Offsets.first;
+        SectionOffsets.find(Section)->second;
+    uint64_t Size = Type == ELF::SHT_NOBITS ? Layout.getSectionAddressSize(&SD)
+                                            : Offsets.second - Offsets.first;
 
     writeSection(Asm, SectionIndexMap, GroupSymbolIndex, Offsets.first, Size,
-                 SD.getAlignment(), Section);
+                 SD.getAlignment(), *Section);
   }
 }
 
 void ELFObjectWriter::WriteObject(MCAssembler &Asm,
                                   const MCAsmLayout &Layout) {
-  CompressDebugSections(Asm, const_cast<MCAsmLayout &>(Layout));
-
-  std::vector<const MCSectionELF *> Sections;
   MCContext &Ctx = Asm.getContext();
   const MCSectionELF *ShstrtabSection =
       Ctx.getELFSection(".shstrtab", ELF::SHT_STRTAB, 0);
-  Sections.push_back(ShstrtabSection);
-  ShstrtabIndex = Sections.size();
+  ShstrtabIndex = addToSectionTable(ShstrtabSection);
 
   RevGroupMapTy RevGroupMap;
   SectionIndexMapTy SectionIndexMap;
@@ -1468,7 +1380,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
       }
       writeRelocations(Asm, *Section.getAssociatedSection());
     } else {
-      Asm.writeSectionData(&SD, Layout);
+      writeSectionData(Asm, SD, Layout);
     }
 
     uint64_t SecEnd = OS.tell();
@@ -1484,8 +1396,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
       unsigned &GroupIdx = RevGroupMap[SignatureSymbol];
       if (!GroupIdx) {
         const MCSectionELF *Group = Ctx.createELFGroupSection(SignatureSymbol);
-        Sections.push_back(Group);
-        GroupIdx = Sections.size();
+        GroupIdx = addToSectionTable(Group);
         MCSectionData *GroupD = &Asm.getOrCreateSectionData(*Group);
         GroupD->setAlignment(4);
       }
@@ -1494,12 +1405,9 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
         GroupMembers[SignatureSymbol].push_back(RelSection);
     }
 
-    Sections.push_back(&Section);
-    SectionIndexMap[&Section] = Sections.size();
-    if (RelSection) {
-      Sections.push_back(RelSection);
-      SectionIndexMap[RelSection] = Sections.size();
-    }
+    SectionIndexMap[&Section] = addToSectionTable(&Section);
+    if (RelSection)
+      SectionIndexMap[RelSection] = addToSectionTable(RelSection);
   }
 
   if (!ComputedSymtab) {
@@ -1508,18 +1416,18 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
     ComputedSymtab = true;
   }
 
-  WriteSymbolTable(Asm, Layout, Sections, SectionOffsets);
+  WriteSymbolTable(Asm, Layout, SectionOffsets);
 
   {
     uint64_t SecStart = OS.tell();
-    const MCSectionELF *Sec = createStringTable(Asm, Sections);
+    const MCSectionELF *Sec = createStringTable(Ctx);
     uint64_t SecEnd = OS.tell();
     SectionOffsets[Sec] = std::make_pair(SecStart, SecEnd);
   }
 
   {
     uint64_t SecStart = OS.tell();
-    const MCSectionELF *Sec = createSectionHeaderStringTable(Asm, Sections);
+    const MCSectionELF *Sec = createSectionHeaderStringTable();
     uint64_t SecEnd = OS.tell();
     SectionOffsets[Sec] = std::make_pair(SecStart, SecEnd);
   }
@@ -1531,11 +1439,11 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
   const unsigned SectionHeaderOffset = OS.tell();
 
   // ... then the section header table ...
-  writeSectionHeader(Sections, Asm, Layout, SectionIndexMap, SectionOffsets);
+  writeSectionHeader(Asm, Layout, SectionIndexMap, SectionOffsets);
 
-  uint16_t NumSections = (Sections.size() + 1 >= ELF::SHN_LORESERVE)
+  uint16_t NumSections = (SectionTable.size() + 1 >= ELF::SHN_LORESERVE)
                              ? (uint16_t)ELF::SHN_UNDEF
-                             : Sections.size() + 1;
+                             : SectionTable.size() + 1;
   if (sys::IsLittleEndianHost != IsLittleEndian)
     sys::swapByteOrder(NumSections);
   unsigned NumSectionsOffset;
@@ -1560,14 +1468,14 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
 }
 
 bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
-    const MCAssembler &Asm, const MCSymbolData &DataA, const MCFragment &FB,
+    const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB,
     bool InSet, bool IsPCRel) const {
   if (IsPCRel) {
     assert(!InSet);
-    if (::isWeak(DataA))
+    if (::isWeak(SymA.getData()))
       return false;
   }
-  return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, DataA, FB,
+  return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
                                                                 InSet, IsPCRel);
 }