Make sure we parse bytecode with a module identifier that reflects the full

name of the module: "Archive.a(object.o)"


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17917 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-11-17 18:25:21 +00:00
parent 7c8dd7f8d3
commit 6ab7a4f9ef
2 changed files with 18 additions and 6 deletions

View File

@ -282,8 +282,10 @@ Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) {
for (iterator I=begin(), E=end(); I != E; ++I) { for (iterator I=begin(), E=end(); I != E; ++I) {
if (I->isBytecode() || I->isCompressedBytecode()) { if (I->isBytecode() || I->isCompressedBytecode()) {
std::string FullMemberName = archPath.get() +
"(" + I->getPath().get() + ")";
Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(), Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(),
I->getSize(), I->getPath().get(), ErrMessage); I->getSize(), FullMemberName, ErrMessage);
if (!M) if (!M)
return true; return true;
@ -391,9 +393,11 @@ Archive::findModuleDefiningSymbol(const std::string& symbol) {
ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size()); ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size());
// Now, load the bytecode module to get the ModuleProvider // Now, load the bytecode module to get the ModuleProvider
std::string FullMemberName = archPath.get() + "(" +
mbr->getPath().get() + ")";
ModuleProvider* mp = getBytecodeBufferModuleProvider( ModuleProvider* mp = getBytecodeBufferModuleProvider(
(const unsigned char*) mbr->getData(), mbr->getSize(), (const unsigned char*) mbr->getData(), mbr->getSize(),
mbr->getPath().get(), 0); FullMemberName, 0);
modules.insert(std::make_pair(fileOffset,std::make_pair(mp,mbr))); modules.insert(std::make_pair(fileOffset,std::make_pair(mp,mbr)));
@ -428,8 +432,10 @@ Archive::findModulesDefiningSymbols(const std::set<std::string>& symbols,
if (mbr->isBytecode() || mbr->isCompressedBytecode()) { if (mbr->isBytecode() || mbr->isCompressedBytecode()) {
// Get the symbols // Get the symbols
std::vector<std::string> symbols; std::vector<std::string> symbols;
std::string FullMemberName = archPath.get() + "(" +
mbr->getPath().get() + ")";
ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At, ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At,
mbr->getSize(), mbr->getPath().get(),symbols); mbr->getSize(), FullMemberName, symbols);
if (MP) { if (MP) {
// Insert the module's symbols into the symbol table // Insert the module's symbols into the symbol table

View File

@ -282,8 +282,10 @@ Archive::getAllModules(std::vector<Module*>& Modules, std::string* ErrMessage) {
for (iterator I=begin(), E=end(); I != E; ++I) { for (iterator I=begin(), E=end(); I != E; ++I) {
if (I->isBytecode() || I->isCompressedBytecode()) { if (I->isBytecode() || I->isCompressedBytecode()) {
std::string FullMemberName = archPath.get() +
"(" + I->getPath().get() + ")";
Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(), Module* M = ParseBytecodeBuffer((const unsigned char*)I->getData(),
I->getSize(), I->getPath().get(), ErrMessage); I->getSize(), FullMemberName, ErrMessage);
if (!M) if (!M)
return true; return true;
@ -391,9 +393,11 @@ Archive::findModuleDefiningSymbol(const std::string& symbol) {
ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size()); ArchiveMember* mbr = parseMemberHeader(modptr, base + mapfile->size());
// Now, load the bytecode module to get the ModuleProvider // Now, load the bytecode module to get the ModuleProvider
std::string FullMemberName = archPath.get() + "(" +
mbr->getPath().get() + ")";
ModuleProvider* mp = getBytecodeBufferModuleProvider( ModuleProvider* mp = getBytecodeBufferModuleProvider(
(const unsigned char*) mbr->getData(), mbr->getSize(), (const unsigned char*) mbr->getData(), mbr->getSize(),
mbr->getPath().get(), 0); FullMemberName, 0);
modules.insert(std::make_pair(fileOffset,std::make_pair(mp,mbr))); modules.insert(std::make_pair(fileOffset,std::make_pair(mp,mbr)));
@ -428,8 +432,10 @@ Archive::findModulesDefiningSymbols(const std::set<std::string>& symbols,
if (mbr->isBytecode() || mbr->isCompressedBytecode()) { if (mbr->isBytecode() || mbr->isCompressedBytecode()) {
// Get the symbols // Get the symbols
std::vector<std::string> symbols; std::vector<std::string> symbols;
std::string FullMemberName = archPath.get() + "(" +
mbr->getPath().get() + ")";
ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At, ModuleProvider* MP = GetBytecodeSymbols((const unsigned char*)At,
mbr->getSize(), mbr->getPath().get(),symbols); mbr->getSize(), FullMemberName, symbols);
if (MP) { if (MP) {
// Insert the module's symbols into the symbol table // Insert the module's symbols into the symbol table