MC/Mach-O: Find section ordinal's by looking at the symbol, instead of assuming they are present in a fragment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2011-04-29 18:07:43 +00:00
parent 49a3ff9d17
commit 08b9935b51

View File

@ -1050,8 +1050,10 @@ public:
FixedValue -= Layout.getSymbolOffset(SD); FixedValue -= Layout.getSymbolOffset(SD);
} else { } else {
// The index is the section ordinal (1-based). // The index is the section ordinal (1-based).
Index = SD->getFragment()->getParent()->getOrdinal() + 1; const MCSectionData &SymSD = Asm.getSectionData(
FixedValue += getSectionAddress(SD->getFragment()->getParent()); SD->getSymbol().getSection());
Index = SymSD.getOrdinal() + 1;
FixedValue += getSectionAddress(&SymSD);
} }
if (IsPCRel) if (IsPCRel)
FixedValue -= getSectionAddress(Fragment->getParent()); FixedValue -= getSectionAddress(Fragment->getParent());
@ -1149,8 +1151,10 @@ public:
FixedValue -= Layout.getSymbolOffset(SD); FixedValue -= Layout.getSymbolOffset(SD);
} else { } else {
// The index is the section ordinal (1-based). // The index is the section ordinal (1-based).
Index = SD->getFragment()->getParent()->getOrdinal() + 1; const MCSectionData &SymSD = Asm.getSectionData(
FixedValue += getSectionAddress(SD->getFragment()->getParent()); SD->getSymbol().getSection());
Index = SymSD.getOrdinal() + 1;
FixedValue += getSectionAddress(&SymSD);
} }
if (IsPCRel) if (IsPCRel)
FixedValue -= getSectionAddress(Fragment->getParent()); FixedValue -= getSectionAddress(Fragment->getParent());