diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-04-29 18:07:43 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-04-29 18:07:43 +0000 |
commit | 08b9935b51f3f83934a5e00b18d0805c1977290a (patch) | |
tree | 685c2b072036858d21f881ce606ec3157ac47536 | |
parent | 49a3ff9d1733cb16bdc97590e5b90508b8656565 (diff) | |
download | external_llvm-08b9935b51f3f83934a5e00b18d0805c1977290a.zip external_llvm-08b9935b51f3f83934a5e00b18d0805c1977290a.tar.gz external_llvm-08b9935b51f3f83934a5e00b18d0805c1977290a.tar.bz2 |
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
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index afa3b5c..dde1c5d 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -1050,8 +1050,10 @@ public: FixedValue -= Layout.getSymbolOffset(SD); } else { // The index is the section ordinal (1-based). - Index = SD->getFragment()->getParent()->getOrdinal() + 1; - FixedValue += getSectionAddress(SD->getFragment()->getParent()); + const MCSectionData &SymSD = Asm.getSectionData( + SD->getSymbol().getSection()); + Index = SymSD.getOrdinal() + 1; + FixedValue += getSectionAddress(&SymSD); } if (IsPCRel) FixedValue -= getSectionAddress(Fragment->getParent()); @@ -1149,8 +1151,10 @@ public: FixedValue -= Layout.getSymbolOffset(SD); } else { // The index is the section ordinal (1-based). - Index = SD->getFragment()->getParent()->getOrdinal() + 1; - FixedValue += getSectionAddress(SD->getFragment()->getParent()); + const MCSectionData &SymSD = Asm.getSectionData( + SD->getSymbol().getSection()); + Index = SymSD.getOrdinal() + 1; + FixedValue += getSectionAddress(&SymSD); } if (IsPCRel) FixedValue -= getSectionAddress(Fragment->getParent()); |