summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-08-19 07:59:35 +0000
committerFangrui Song <maskray@google.com>2019-08-19 07:59:35 +0000
commitb127771f7d2972acad81550e03cc4e1e3c1fcd1c (patch)
treeca68aa6c0f3f45031865a050da20a367fedf4979 /llvm/lib/MC/ELFObjectWriter.cpp
parent17587b36d1928c3399d4d9af6daa052c0cdd6327 (diff)
downloadbcm5719-llvm-b127771f7d2972acad81550e03cc4e1e3c1fcd1c.tar.gz
bcm5719-llvm-b127771f7d2972acad81550e03cc4e1e3c1fcd1c.zip
[MC] Delete unnecessary diagnostic: "No relocation available to represent this relative expression"
Replace - error: No relocation available to represent this relative expression with + error: symbol 'undef' can not be undefined in a subtraction expression or + error: Cannot represent a difference across sections Keep !IsPcRel as an assertion after the two diagnostic checks are done. llvm-svn: 369239
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 111ba3fab39..97607b43295 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1441,22 +1441,7 @@ void ELFObjectWriter::recordRelocation(MCAssembler &Asm,
MCContext &Ctx = Asm.getContext();
if (const MCSymbolRefExpr *RefB = Target.getSymB()) {
- // Let A, B and C being the components of Target and R be the location of
- // the fixup. If the fixup is not pcrel, we want to compute (A - B + C).
- // If it is pcrel, we want to compute (A - B + C - R).
-
- // In general, ELF has no relocations for -B. It can only represent (A + C)
- // 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) {
- Ctx.reportError(
- Fixup.getLoc(),
- "No relocation available to represent this relative expression");
- return;
- }
-
const auto &SymB = cast<MCSymbolELF>(RefB->getSymbol());
-
if (SymB.isUndefined()) {
Ctx.reportError(Fixup.getLoc(),
Twine("symbol '") + SymB.getName() +
@@ -1474,6 +1459,7 @@ void ELFObjectWriter::recordRelocation(MCAssembler &Asm,
uint64_t SymBOffset = Layout.getSymbolOffset(SymB);
uint64_t K = SymBOffset - FixupOffset;
+ assert(!IsPCRel && "should have been folded");
IsPCRel = true;
C -= K;
}
OpenPOWER on IntegriCloud