[PATCH] D25272: [ELF] - Fixed behavior when amount of inputsections is too large.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 10 05:56:14 PDT 2016
grimar updated this revision to Diff 74120.
grimar added a comment.
- Updated logic.
https://reviews.llvm.org/D25272
Files:
ELF/InputFiles.cpp
Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -228,11 +228,12 @@
template <class ELFT>
void elf::ObjectFile<ELFT>::initializeSections(
DenseSet<StringRef> &ComdatGroups) {
- uint64_t Size = this->ELFObj.getNumSections();
- Sections.resize(Size);
- unsigned I = -1;
const ELFFile<ELFT> &Obj = this->ELFObj;
- for (const Elf_Shdr &Sec : Obj.sections()) {
+ typename ELFT::ShdrRange R = Obj.sections();
+
+ Sections.resize(R.size());
+ unsigned I = -1;
+ for (const Elf_Shdr &Sec : R) {
++I;
if (Sections[I] == &InputSection<ELFT>::Discarded)
continue;
@@ -251,7 +252,7 @@
if (ComdatGroups.insert(getShtGroupSignature(Sec)).second)
continue;
for (uint32_t SecIndex : getShtGroupEntries(Sec)) {
- if (SecIndex >= Size)
+ if (SecIndex >= R.size())
fatal(getFilename(this) + ": invalid section index in group: " +
Twine(SecIndex));
Sections[SecIndex] = &InputSection<ELFT>::Discarded;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25272.74120.patch
Type: text/x-patch
Size: 1109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161010/428667ae/attachment.bin>
More information about the llvm-commits
mailing list