[llvm-commits] [llvm] r99504 - /llvm/trunk/lib/MC/MachObjectWriter.cpp
Daniel Dunbar
daniel at zuster.org
Thu Mar 25 01:08:54 PDT 2010
Author: ddunbar
Date: Thu Mar 25 03:08:54 2010
New Revision: 99504
URL: http://llvm.org/viewvc/llvm-project?rev=99504&view=rev
Log:
MC/Mach-O: Switch to MCSectionData::getOrdinal.
Modified:
llvm/trunk/lib/MC/MachObjectWriter.cpp
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=99504&r1=99503&r2=99504&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Thu Mar 25 03:08:54 2010
@@ -559,15 +559,8 @@
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 @@
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);
}
More information about the llvm-commits
mailing list