aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-11-27 05:18:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-11-27 05:18:48 +0000
commit7976b88d9f415023e4ee498cb6d4a2d20532c873 (patch)
tree0b678290ddeac732c52934c848816fa86bbc15c2 /lib/MC/MachObjectWriter.cpp
parentf52788f4e6951ac8b6e46100eb5ee6a0a4244a00 (diff)
Reduce nesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MachObjectWriter.cpp')
-rw-r--r--lib/MC/MachObjectWriter.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp
index e2db298700..07bfd0e239 100644
--- a/lib/MC/MachObjectWriter.cpp
+++ b/lib/MC/MachObjectWriter.cpp
@@ -1050,29 +1050,35 @@ public:
const MCValue Target,
bool IsPCRel,
const MCFragment *DF) const {
- // If we are using scattered symbols, determine whether this value is
- // actually resolved; scattering may cause atoms to move.
- if (Asm.getBackend().hasScatteredSymbols()) {
- if (Asm.getBackend().hasReliableSymbolDifference()) {
- // If this is a PCrel relocation, find the base atom (identified by its
- // symbol) that the fixup value is relative to.
- const MCSymbolData *BaseSymbol = 0;
- if (IsPCRel) {
- BaseSymbol = DF->getAtom();
- if (!BaseSymbol)
- return false;
- }
+ // If we aren't using scattered symbols, the fixup is fully resolved.
+ if (!Asm.getBackend().hasScatteredSymbols())
+ return true;
- return isScatteredFixupFullyResolved(Asm, Target, BaseSymbol);
- } else {
- const MCSection *BaseSection = 0;
- if (IsPCRel)
- BaseSection = &DF->getParent()->getSection();
+ // Otherwise, determine whether this value is actually resolved; scattering
+ // may cause atoms to move.
- return isScatteredFixupFullyResolvedSimple(Asm, Target, BaseSection);
- }
+ // Check if we are using the "simple" resolution algorithm (e.g.,
+ // i386).
+ if (!Asm.getBackend().hasReliableSymbolDifference()) {
+ const MCSection *BaseSection = 0;
+ if (IsPCRel)
+ BaseSection = &DF->getParent()->getSection();
+
+ return isScatteredFixupFullyResolvedSimple(Asm, Target, BaseSection);
}
- return true;
+
+ // Otherwise, compute the proper answer as reliably as possible.
+
+ // If this is a PCrel relocation, find the base atom (identified by its
+ // symbol) that the fixup value is relative to.
+ const MCSymbolData *BaseSymbol = 0;
+ if (IsPCRel) {
+ BaseSymbol = DF->getAtom();
+ if (!BaseSymbol)
+ return false;
+ }
+
+ return isScatteredFixupFullyResolved(Asm, Target, BaseSymbol);
}
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) {