From 35d6189f0fc2bbb103846ffaac4b3e0043607885 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 17 Apr 2015 21:15:17 +0000 Subject: Compute A-B when A or B is weak. Similar to r235222, but for the weak symbol case. In an "ideal" assembler/object format an expression would always refer to the final value and A-B would only be computed from a section in the same comdat as A and B with A and B strong. Unfortunately that is not the case with debug info on ELF, so we need an heuristic. Since we need an heuristic, we may as well use the same one as gas: * call weak_sym : produces a relocation, even if in the same section. * A - weak_sym and weak_sym -A: don't produce a relocation if we can compute it. This fixes pr23272 and changes the fix of pr22815 to match what gas does. llvm-svn: 235227 --- llvm/lib/MC/MCObjectWriter.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'llvm/lib/MC/MCObjectWriter.cpp') diff --git a/llvm/lib/MC/MCObjectWriter.cpp b/llvm/lib/MC/MCObjectWriter.cpp index e40c07d5527..e90dea81479 100644 --- a/llvm/lib/MC/MCObjectWriter.cpp +++ b/llvm/lib/MC/MCObjectWriter.cpp @@ -36,13 +36,12 @@ bool MCObjectWriter::IsSymbolRefDifferenceFullyResolved( return false; return IsSymbolRefDifferenceFullyResolvedImpl( - Asm, DataA, &DataB, *DataB.getFragment(), InSet, false); + Asm, DataA, *DataB.getFragment(), InSet, false); } bool MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl( - const MCAssembler &Asm, const MCSymbolData &DataA, - const MCSymbolData *DataB, const MCFragment &FB, bool InSet, - bool IsPCRel) const { + const MCAssembler &Asm, const MCSymbolData &DataA, const MCFragment &FB, + bool InSet, bool IsPCRel) const { const MCSection &SecA = DataA.getSymbol().getSection(); const MCSection &SecB = FB.getParent()->getSection(); // On ELF and COFF A - B is absolute if A and B are in the same section. -- cgit v1.2.3