diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-03-25 08:08:54 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-03-25 08:08:54 +0000 |
commit | 8fb040308c25829ad16baaffe4f3c6ba4ac462f6 (patch) | |
tree | 24830fae6a8103781fed07cadf9fc631031476b9 /lib/MC/MachObjectWriter.cpp | |
parent | 4ec9bd9a6f92a10185870bae2cebce199f6acc5a (diff) | |
download | external_llvm-8fb040308c25829ad16baaffe4f3c6ba4ac462f6.zip external_llvm-8fb040308c25829ad16baaffe4f3c6ba4ac462f6.tar.gz external_llvm-8fb040308c25829ad16baaffe4f3c6ba4ac462f6.tar.bz2 |
MC/Mach-O: Switch to MCSectionData::getOrdinal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index 44e9839..194be6e 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -559,15 +559,8 @@ public: if (Base != &SD) Value += Layout.getSymbolAddress(&SD) - Layout.getSymbolAddress(Base); } else { - // The index is the section ordinal. - // - // FIXME: O(N) - Index = 1; - MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end(); - for (; it != ie; ++it, ++Index) - if (&*it == SD.getFragment()->getParent()) - break; - assert(it != ie && "Unable to find section index!"); + // The index is the section ordinal (1-based). + Index = SD.getFragment()->getParent()->getOrdinal() + 1; IsExtern = 0; Value += Layout.getSymbolAddress(&SD); @@ -747,15 +740,8 @@ public: Index = SD->getIndex(); Value = 0; } else { - // The index is the section ordinal. - // - // FIXME: O(N) - Index = 1; - MCAssembler::const_iterator it = Asm.begin(), ie = Asm.end(); - for (; it != ie; ++it, ++Index) - if (&*it == SD->getFragment()->getParent()) - break; - assert(it != ie && "Unable to find section index!"); + // The index is the section ordinal (1-based). + Index = SD->getFragment()->getParent()->getOrdinal() + 1; Value = Layout.getSymbolAddress(SD); } |