From b718237dfc05aa4c0c8c284f79fe41a2a4a14574 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 20 Jan 2016 18:57:48 +0000 Subject: Accept subtractions involving a weak symbol. When a symbol S shows up in an expression in assembly there are two possible interpretations * The expression is referring to the value of S in this file. * The expression is referring to the value after symbol resolution. In the first case the assembler can reason about the value and try to produce a relocation. In the second case, that is only possible if the symbol cannot be preempted. Assemblers are not very consistent about which interpretation gets used. This changes MC to agree with GAS in the case of an expression of the form "Sym - WeakSym". llvm-svn: 258329 --- llvm/lib/MC/ELFObjectWriter.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'llvm/lib/MC/ELFObjectWriter.cpp') diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp index 23d0e28324c..20ad41659f4 100644 --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -655,12 +655,6 @@ void ELFObjectWriter::recordRelocation(MCAssembler &Asm, return; } - if (::isWeak(SymB)) { - Ctx.reportError(Fixup.getLoc(), - "Cannot represent a subtraction with a weak symbol"); - return; - } - uint64_t SymBOffset = Layout.getSymbolOffset(SymB); uint64_t K = SymBOffset - FixupOffset; IsPCRel = true; -- cgit v1.2.3