summaryrefslogtreecommitdiff
path: root/lib/MC/WinCOFFObjectWriter.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-06-26 20:32:52 +0000
commit08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 (patch)
tree80108f0f128657f8623f8f66ad9735b4d88e7b47 /lib/MC/WinCOFFObjectWriter.cpp
parent7c7aba6e5fef47a01a136be655b0a92cfd7090f6 (diff)
Diffstat (limited to 'lib/MC/WinCOFFObjectWriter.cpp')
-rw-r--r--lib/MC/WinCOFFObjectWriter.cpp24
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?