[lld] r239289 - COFF: Add more log messages.
Rui Ueyama
ruiu at google.com
Sun Jun 7 23:00:11 PDT 2015
Author: ruiu
Date: Mon Jun 8 01:00:10 2015
New Revision: 239289
URL: http://llvm.org/viewvc/llvm-project?rev=239289&view=rev
Log:
COFF: Add more log messages.
Modified:
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/InputFiles.h
lld/trunk/COFF/SymbolTable.cpp
lld/trunk/COFF/SymbolTable.h
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=239289&r1=239288&r2=239289&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Mon Jun 8 01:00:10 2015
@@ -334,6 +334,8 @@ bool LinkerDriver::link(int Argc, const
return false;
}
std::unique_ptr<InputFile> File = std::move(FileOrErr.get());
+ if (Config->Verbose)
+ llvm::outs() << "Reading " << File->getName() << "\n";
if (auto EC = Symtab.addFile(std::move(File))) {
llvm::errs() << Path << ": " << EC.message() << "\n";
return false;
Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=239289&r1=239288&r2=239289&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Mon Jun 8 01:00:10 2015
@@ -54,6 +54,9 @@ public:
// Sets a parent filename if this file is created from an archive.
void setParentName(StringRef N) { ParentName = N; }
+ // Returns .drectve section contents if exist.
+ virtual StringRef getDirectives() { return ""; }
+
protected:
explicit InputFile(Kind K, MemoryBufferRef M) : MB(M), FileKind(K) {}
MemoryBufferRef MB;
@@ -99,12 +102,11 @@ public:
// underlying object file.
SymbolBody *getSymbolBody(uint32_t SymbolIndex);
- // Returns .drectve section contents if exist.
- StringRef getDirectives() { return Directives; }
-
// Returns the underying COFF file.
COFFObjectFile *getCOFFObj() { return COFFObj.get(); }
+ StringRef getDirectives() override { return Directives; }
+
private:
std::error_code initializeChunks();
std::error_code initializeSymbols();
@@ -165,7 +167,7 @@ public:
LTOModule *releaseModule() { return M.release(); }
// Returns linker directives from module flags metadata if present.
- StringRef getDirectives() { return Directives; }
+ StringRef getDirectives() override { return Directives; }
private:
std::error_code parse() override;
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=239289&r1=239288&r2=239289&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Mon Jun 8 01:00:10 2015
@@ -40,14 +40,20 @@ std::error_code SymbolTable::addFile(std
return addImport(cast<ImportFile>(FileP));
}
-std::error_code SymbolTable::addDirectives(StringRef Dir) {
- if (Dir.empty())
+std::error_code SymbolTable::addDirectives(InputFile *File) {
+ StringRef S = File->getDirectives();
+ if (S.empty())
return std::error_code();
std::vector<std::unique_ptr<InputFile>> Libs;
- if (auto EC = Driver->parseDirectives(Dir, &Libs))
+ if (auto EC = Driver->parseDirectives(S, &Libs))
return EC;
- for (std::unique_ptr<InputFile> &Lib : Libs)
+ for (std::unique_ptr<InputFile> &Lib : Libs) {
+ if (Config->Verbose) {
+ llvm::outs() << "Reading " << Lib->getName()
+ << " for " << File->getName() << "\n";
+ }
addFile(std::move(Lib));
+ }
return std::error_code();
}
@@ -60,7 +66,7 @@ std::error_code SymbolTable::addObject(O
// If an object file contains .drectve section, read it and add
// files listed in the section.
- return addDirectives(File->getDirectives());
+ return addDirectives(File);
}
std::error_code SymbolTable::addArchive(ArchiveFile *File) {
@@ -79,7 +85,7 @@ std::error_code SymbolTable::addBitcode(
return EC;
// Add any linker directives from the module flags metadata.
- return addDirectives(File->getDirectives());
+ return addDirectives(File);
}
std::error_code SymbolTable::addImport(ImportFile *File) {
Modified: lld/trunk/COFF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.h?rev=239289&r1=239288&r2=239289&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.h (original)
+++ lld/trunk/COFF/SymbolTable.h Mon Jun 8 01:00:10 2015
@@ -77,7 +77,7 @@ public:
std::error_code rename(StringRef From, StringRef To);
private:
- std::error_code addDirectives(StringRef Dir);
+ std::error_code addDirectives(InputFile *File);
std::error_code addObject(ObjectFile *File);
std::error_code addArchive(ArchiveFile *File);
More information about the llvm-commits
mailing list