diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-01-17 22:14:39 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-01-17 22:14:39 +0000 |
commit | 4045507fea848cfe416d5741dbb5965bb3f3212e (patch) | |
tree | 95f2fe2445e6cd279ddda070da90fba6ad11529f /llvm/lib/MC/MachObjectWriter.cpp | |
parent | 65499b45f0ba4b3d9c32dd477869c359af4e5ab9 (diff) | |
download | bcm5719-llvm-4045507fea848cfe416d5741dbb5965bb3f3212e.tar.gz bcm5719-llvm-4045507fea848cfe416d5741dbb5965bb3f3212e.zip |
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
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |