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 | 8b9300b972745a6d89b482cbcd4206c01359f7df (patch) | |
tree | 071c86c422c7148217e4bc75b6849d8b5227d38b /lib/MC | |
parent | 283f1fff47db3a483ab94e4b49cc39eb39dd48ea (diff) | |
download | external_llvm-8b9300b972745a6d89b482cbcd4206c01359f7df.zip external_llvm-8b9300b972745a6d89b482cbcd4206c01359f7df.tar.gz external_llvm-8b9300b972745a6d89b482cbcd4206c01359f7df.tar.bz2 |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148341 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index e016f09..ce222b7 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/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; } |