From 4045507fea848cfe416d5741dbb5965bb3f3212e Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Tue, 17 Jan 2012 22:14:39 +0000 Subject: MC tweak symbol difference resolution for non-local symbols. When the non-local symbol in the expression is in the same fragment as the second symbol, the assembler can still evaluate the expression without needing a relocation. For example, on ARM: _foo: ldr lr, (_foo - 4) rdar://10348687 llvm-svn: 148341 --- llvm/lib/MC/MachObjectWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/MC/MachObjectWriter.cpp') diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index e016f09c95f..ce222b75cf4 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -590,8 +590,8 @@ IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, // assembler locals. if (!Asm.getBackend().hasReliableSymbolDifference()) { - if ((!SA.isTemporary() && Asm.getSubsectionsViaSymbols()) || - !SA.isInSection() || &SecA != &SecB) + if (!SA.isInSection() || &SecA != &SecB || + (!SA.isTemporary() && &FB != Asm.getSymbolData(SA).getFragment())) return false; return true; } -- cgit v1.2.3