summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-25 08:08:54 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-25 08:08:54 +0000
commit951459740c04078404fd989c1292ba917803cd43 (patch)
treedb3421ca13c70c0f74f8ea8c0ec21b82f845d3f1 /llvm/lib/MC/MachObjectWriter.cpp
parent1889440b52155da3e7f62969924204149b574b97 (diff)
downloadbcm5719-llvm-951459740c04078404fd989c1292ba917803cd43.tar.gz
bcm5719-llvm-951459740c04078404fd989c1292ba917803cd43.zip
MC/Mach-O: Switch to MCSectionData::getOrdinal.
llvm-svn: 99504
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index 44e98394629..194be6e4713 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud