From b323113b93a14f8032e060b5d05a39c2242e4acc Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 15 Nov 2004 01:40:20 +0000 Subject: [PATCH] * Make sure the string table gets read even if there isn't a foreign symbol table. * Make sure we update the file pointer for each member when rebuilding the symbol table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17812 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Archive/ArchiveReader.cpp | 28 ++++++++++++++++++-------- lib/Bytecode/Archive/ArchiveReader.cpp | 28 ++++++++++++++++++-------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/lib/Archive/ArchiveReader.cpp b/lib/Archive/ArchiveReader.cpp index 794e1b271f3..7f85894072a 100644 --- a/lib/Archive/ArchiveReader.cpp +++ b/lib/Archive/ArchiveReader.cpp @@ -309,18 +309,25 @@ Archive::loadSymbolTable() { if (mbr->isForeignSymbolTable()) { // Skip the foreign symbol table, we don't do anything with it At += mbr->getSize(); + if (mbr->getSize() % 2 != 0) + At++; delete mbr; - // See if there's a string table too + // Read the next one + FirstFile = At; + mbr = parseMemberHeader(At,End); + } + + if (mbr->isStringTable()) { + // Process the string table entry + strtab.assign((const char*)mbr->getData(),mbr->getSize()); + At += mbr->getSize(); + if (mbr->getSize() % 2 != 0) + At++; + delete mbr; + // Get the next one FirstFile = At; mbr = parseMemberHeader(At,End); - if (mbr->isStringTable()) { - strtab.assign((const char*)mbr->getData(),mbr->getSize()); - At += mbr->getSize(); - delete mbr; - FirstFile = At; - mbr = parseMemberHeader(At,End); - } } // See if its the symbol table @@ -432,6 +439,11 @@ Archive::findModulesDefiningSymbols(const std::set& symbols, mbr->getPath().get(); } } + + // Go to the next file location + At += mbr->getSize(); + if (mbr->getSize() % 2 != 0) + At++; } } diff --git a/lib/Bytecode/Archive/ArchiveReader.cpp b/lib/Bytecode/Archive/ArchiveReader.cpp index 794e1b271f3..7f85894072a 100644 --- a/lib/Bytecode/Archive/ArchiveReader.cpp +++ b/lib/Bytecode/Archive/ArchiveReader.cpp @@ -309,18 +309,25 @@ Archive::loadSymbolTable() { if (mbr->isForeignSymbolTable()) { // Skip the foreign symbol table, we don't do anything with it At += mbr->getSize(); + if (mbr->getSize() % 2 != 0) + At++; delete mbr; - // See if there's a string table too + // Read the next one + FirstFile = At; + mbr = parseMemberHeader(At,End); + } + + if (mbr->isStringTable()) { + // Process the string table entry + strtab.assign((const char*)mbr->getData(),mbr->getSize()); + At += mbr->getSize(); + if (mbr->getSize() % 2 != 0) + At++; + delete mbr; + // Get the next one FirstFile = At; mbr = parseMemberHeader(At,End); - if (mbr->isStringTable()) { - strtab.assign((const char*)mbr->getData(),mbr->getSize()); - At += mbr->getSize(); - delete mbr; - FirstFile = At; - mbr = parseMemberHeader(At,End); - } } // See if its the symbol table @@ -432,6 +439,11 @@ Archive::findModulesDefiningSymbols(const std::set& symbols, mbr->getPath().get(); } } + + // Go to the next file location + At += mbr->getSize(); + if (mbr->getSize() % 2 != 0) + At++; } }