diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-24 21:22:02 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-24 21:22:02 +0000 |
commit | fea753b397823c340608925eb7f3256a64a30017 (patch) | |
tree | 91016581c74485267516a02e4066ef865445cc0d /lib/MC/WinCOFFObjectWriter.cpp | |
parent | a112087e4298ca8ec1bc8aef8a2b272e49faa7ac (diff) |
Merge IsFixupFullyResolved and IsSymbolRefDifferenceFullyResolved. We now
have a single point where targets test if a relocation is needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/WinCOFFObjectWriter.cpp')
-rw-r--r-- | lib/MC/WinCOFFObjectWriter.cpp | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 3a88a03f8b..48a7c3bd64 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -179,10 +179,12 @@ public: MCValue Target, uint64_t &FixedValue); - virtual bool IsFixupFullyResolved(const MCAssembler &Asm, - const MCValue Target, - bool IsPCRel, - const MCFragment *DF) const; + virtual bool + IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, + const MCSymbolData &DataA, + const MCFragment &FB, + bool InSet, + bool IsPCRel) const; void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout); }; @@ -717,34 +719,17 @@ void WinCOFFObjectWriter::RecordRelocation(const MCAssembler &Asm, coff_section->Relocations.push_back(Reloc); } -bool WinCOFFObjectWriter::IsFixupFullyResolved(const MCAssembler &Asm, - const MCValue Target, - bool IsPCRel, - const MCFragment *DF) const { - // If this is a PCrel relocation, find the section this fixup value is - // relative to. - const MCSection *BaseSection = 0; - if (IsPCRel) { - BaseSection = &DF->getParent()->getSection(); - assert(BaseSection); - } - - const MCSection *SectionA = 0; - const MCSymbol *SymbolA = 0; - if (const MCSymbolRefExpr *A = Target.getSymA()) { - SymbolA = &A->getSymbol(); - SectionA = &SymbolA->getSection(); - } - - const MCSection *SectionB = 0; - if (const MCSymbolRefExpr *B = Target.getSymB()) { - SectionB = &B->getSymbol().getSection(); - } - - if (!BaseSection) - return SectionA == SectionB; - - return !SectionB && BaseSection == SectionA; +bool +WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl( + const MCAssembler &Asm, + const MCSymbolData &DataA, + const MCFragment &FB, + bool InSet, + bool IsPCRel) const { + const MCSection &SecA = DataA.getSymbol().AliasedSymbol().getSection(); + const MCSection &SecB = FB.getParent()->getSection(); + // On COFF A - B is absolute if A and B are in the same section. + return &SecA == &SecB; } void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm, |