diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-12-17 04:54:54 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-12-17 04:54:54 +0000 |
commit | 1f3662abba2abdf5a0ab77095834271fcf846579 (patch) | |
tree | bee75eb48cbf921a33bb28c5af57d5e910a583de | |
parent | ff2e9b4225ab55ee049b33158a9cce1ef138c2f7 (diff) |
MC/ObjectWriter: Add a new IsSymbolRefDifferenceFullyResolved target format specific hook.
- Currently just has stub implementations for Mach-O, ELF, and COFF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122037 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCObjectWriter.h | 11 | ||||
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 13 | ||||
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 6 | ||||
-rw-r--r-- | lib/MC/WinCOFFObjectWriter.cpp | 8 |
4 files changed, 36 insertions, 2 deletions
diff --git a/include/llvm/MC/MCObjectWriter.h b/include/llvm/MC/MCObjectWriter.h index bae3368f96..60625b4b53 100644 --- a/include/llvm/MC/MCObjectWriter.h +++ b/include/llvm/MC/MCObjectWriter.h @@ -20,6 +20,7 @@ class MCAsmLayout; class MCAssembler; class MCFixup; class MCFragment; +class MCSymbolRefExpr; class MCValue; class raw_ostream; @@ -77,6 +78,16 @@ public: const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) = 0; + /// \brief Check whether the difference (A - B) between two symbol + /// references is fully resolved. + /// + /// Clients are not required to answer precisely and may conservatively return + /// false, even when a difference is fully resolved. + virtual bool + IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm, + const MCSymbolRefExpr *A, + const MCSymbolRefExpr *B) const = 0; + /// Check if a fixup is fully resolved. /// /// This routine is used by the assembler to let the file format decide diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 1369d827b1..b9804d474b 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -333,8 +333,17 @@ namespace { uint64_t Size, uint32_t Link, uint32_t Info, uint64_t Alignment, uint64_t EntrySize); - virtual void WriteRelocationsFragment(const MCAssembler &Asm, MCDataFragment *F, - const MCSectionData *SD); + virtual void WriteRelocationsFragment(const MCAssembler &Asm, + MCDataFragment *F, + const MCSectionData *SD); + + virtual bool + IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm, + const MCSymbolRefExpr *A, + const MCSymbolRefExpr *B) const { + // FIXME: Implement this! + return false; + } virtual bool IsFixupFullyResolved(const MCAssembler &Asm, const MCValue Target, diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index d050ef0bd4..e12daa708b 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -1123,6 +1123,12 @@ public: UndefinedSymbolData); } + bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm, + const MCSymbolRefExpr *A, + const MCSymbolRefExpr *B) const { + return false; + } + bool IsFixupFullyResolved(const MCAssembler &Asm, const MCValue Target, bool IsPCRel, diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 3a88a03f8b..0ad086cbee 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -179,6 +179,14 @@ public: MCValue Target, uint64_t &FixedValue); + virtual bool + IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm, + const MCSymbolRefExpr *A, + const MCSymbolRefExpr *B) const { + // FIXME: Implement this! + return false; + } + virtual bool IsFixupFullyResolved(const MCAssembler &Asm, const MCValue Target, bool IsPCRel, |