[llvm-commits] [lld] r172236 - /lld/trunk/lib/ReaderWriter/ELF/WriterELF.cpp
Shankar Easwaran
shankare at codeaurora.org
Fri Jan 11 10:56:11 PST 2013
Author: shankare
Date: Fri Jan 11 12:56:11 2013
New Revision: 172236
URL: http://llvm.org/viewvc/llvm-project?rev=172236&view=rev
Log:
better implementation for findOutputSection
Modified:
lld/trunk/lib/ReaderWriter/ELF/WriterELF.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/WriterELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/WriterELF.cpp?rev=172236&r1=172235&r2=172236&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/WriterELF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/WriterELF.cpp Fri Jan 11 12:56:11 2013
@@ -1716,23 +1716,13 @@
return error_code::success();
}
- /// \biref Find an output Section given a section name.
- ///
- /// \todo Make this not O(n). We can't use _mergedSectionMap because it
- /// doesn't get virtual addresses set :(
- Chunk<target_endianness, max_align, is64Bits> *
+ /// \brief Find an output Section given a section name.
+ MergedSections<target_endianness, max_align, is64Bits> *
findOutputSection(StringRef name) {
- for (auto seg : _segments) {
- for (auto sliceI = seg->slices_begin(),
- sliceE = seg->slices_end(); sliceI != sliceE; ++sliceI) {
- for (auto secI = (*sliceI)->sections_begin(),
- secE = (*sliceI)->sections_end(); secI != secE; ++secI) {
- if ((*secI)->name() == name)
- return *secI;
- }
- }
- }
- return nullptr;
+ auto iter = _mergedSectionMap.find(name);
+ if (iter == _mergedSectionMap.end())
+ return nullptr;
+ return iter->second;
}
/// \brief find a absolute atom given a name
More information about the llvm-commits
mailing list