diff options
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 13 | ||||
| -rw-r--r-- | lld/ELF/InputFiles.h | 6 | ||||
| -rw-r--r-- | lld/ELF/Symbols.cpp | 6 |
3 files changed, 12 insertions, 13 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index dbfc867af7e..8a8bf6061e7 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -1010,14 +1010,14 @@ void ArchiveFile::parse() { } // Returns a buffer pointing to a member file containing a given symbol. -InputFile *ArchiveFile::fetch(const Archive::Symbol &Sym) { +void ArchiveFile::fetch(const Archive::Symbol &Sym) { Archive::Child C = CHECK(Sym.getMember(), toString(this) + ": could not get the member for symbol " + Sym.getName()); if (!Seen.insert(C.getChildOffset()).second) - return nullptr; + return; MemoryBufferRef MB = CHECK(C.getMemoryBufferRef(), @@ -1031,7 +1031,7 @@ InputFile *ArchiveFile::fetch(const Archive::Symbol &Sym) { InputFile *File = createObjectFile( MB, getName(), C.getParent()->isThin() ? 0 : C.getChildOffset()); File->GroupId = GroupId; - return File; + parseFile(File); } unsigned SharedFile::VernauxNum; @@ -1469,9 +1469,9 @@ InputFile *elf::createSharedFile(MemoryBufferRef MB, StringRef DefaultSoName) { return F; } -InputFile *LazyObjFile::fetch() { +void LazyObjFile::fetch() { if (MB.getBuffer().empty()) - return nullptr; + return; InputFile *File = createObjectFile(MB, ArchiveName, OffsetInArchive); File->GroupId = GroupId; @@ -1481,7 +1481,8 @@ InputFile *LazyObjFile::fetch() { // Copy symbol vector so that the new InputFile doesn't have to // insert the same defined symbols to the symbol table again. File->Symbols = std::move(Symbols); - return File; + + parseFile(File); } template <class ELFT> void LazyObjFile::parse() { diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 8b112e59250..648f5b51452 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -307,7 +307,7 @@ public: static bool classof(const InputFile *F) { return F->kind() == LazyObjKind; } template <class ELFT> void parse(); - InputFile *fetch(); + void fetch(); private: uint64_t OffsetInArchive; @@ -322,9 +322,9 @@ public: // Pulls out an object file that contains a definition for Sym and // returns it. If the same file was instantiated before, this - // function returns a nullptr (so we don't instantiate the same file + // function does nothing (so we don't instantiate the same file // more than once.) - InputFile *fetch(const Archive::Symbol &Sym); + void fetch(const Archive::Symbol &Sym); private: std::unique_ptr<Archive> File; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 94f0d6ea6cb..d44b24dd1b3 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -243,14 +243,12 @@ void Symbol::parseSymbolVersion() { void Symbol::fetch() const { if (auto *Sym = dyn_cast<LazyArchive>(this)) { - if (auto *F = cast<ArchiveFile>(Sym->File)->fetch(Sym->Sym)) - parseFile(F); + cast<ArchiveFile>(Sym->File)->fetch(Sym->Sym); return; } if (auto *Sym = dyn_cast<LazyObject>(this)) { - if (auto *F = dyn_cast<LazyObjFile>(Sym->File)->fetch()) - parseFile(F); + dyn_cast<LazyObjFile>(Sym->File)->fetch(); return; } |

