diff options
Diffstat (limited to 'lib/MC/WinCOFFObjectWriter.cpp')
| -rw-r--r-- | lib/MC/WinCOFFObjectWriter.cpp | 24 | 
1 files changed, 2 insertions, 22 deletions
diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 53dee3e8b9f3..fc5234950391 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -735,7 +735,6 @@ void WinCOFFObjectWriter::recordRelocation(    COFFSection *Sec = SectionMap[MCSec];    const MCSymbolRefExpr *SymB = Target.getSymB(); -  bool CrossSection = false;    if (SymB) {      const MCSymbol *B = &SymB->getSymbol(); @@ -747,28 +746,9 @@ void WinCOFFObjectWriter::recordRelocation(        return;      } -    if (!A.getFragment()) { -      Asm.getContext().reportError( -          Fixup.getLoc(), -          Twine("symbol '") + A.getName() + -              "' can not be undefined in a subtraction expression"); -      return; -    } - -    CrossSection = &A.getSection() != &B->getSection(); -      // Offset of the symbol in the section      int64_t OffsetOfB = Layout.getSymbolOffset(*B); -    // In the case where we have SymbA and SymB, we just need to store the delta -    // between the two symbols.  Update FixedValue to account for the delta, and -    // skip recording the relocation. -    if (!CrossSection) { -      int64_t OffsetOfA = Layout.getSymbolOffset(A); -      FixedValue = (OffsetOfA - OffsetOfB) + Target.getConstant(); -      return; -    } -      // Offset of the relocation in the section      int64_t OffsetOfRelocation =          Layout.getFragmentOffset(Fragment) + Fixup.getOffset(); @@ -784,7 +764,7 @@ void WinCOFFObjectWriter::recordRelocation(    Reloc.Data.VirtualAddress = Layout.getFragmentOffset(Fragment);    // Turn relocations for temporary symbols into section relocations. -  if (A.isTemporary() || CrossSection) { +  if (A.isTemporary()) {      MCSection *TargetSection = &A.getSection();      assert(          SectionMap.find(TargetSection) != SectionMap.end() && @@ -802,7 +782,7 @@ void WinCOFFObjectWriter::recordRelocation(    Reloc.Data.VirtualAddress += Fixup.getOffset();    Reloc.Data.Type = TargetObjectWriter->getRelocType( -      Target, Fixup, CrossSection, Asm.getBackend()); +      Asm.getContext(), Target, Fixup, SymB, Asm.getBackend());    // FIXME: Can anyone explain what this does other than adjust for the size    // of the offset?  | 
