aboutsummaryrefslogtreecommitdiff
path: root/COFF/Driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'COFF/Driver.h')
-rw-r--r--COFF/Driver.h43
1 files changed, 22 insertions, 21 deletions
diff --git a/COFF/Driver.h b/COFF/Driver.h
index 6879be2eb0c7..63d41cf69093 100644
--- a/COFF/Driver.h
+++ b/COFF/Driver.h
@@ -12,8 +12,8 @@
#include "Config.h"
#include "SymbolTable.h"
-#include "lld/Core/LLVM.h"
-#include "lld/Core/Reproduce.h"
+#include "lld/Common/LLVM.h"
+#include "lld/Common/Reproduce.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Object/Archive.h"
@@ -36,31 +36,35 @@ using llvm::COFF::WindowsSubsystem;
using llvm::Optional;
// Implemented in MarkLive.cpp.
-void markLive(const std::vector<Chunk *> &Chunks);
+void markLive(ArrayRef<Chunk *> Chunks);
// Implemented in ICF.cpp.
-void doICF(const std::vector<Chunk *> &Chunks);
+void doICF(ArrayRef<Chunk *> Chunks);
-class ArgParser {
+class COFFOptTable : public llvm::opt::OptTable {
public:
- // Parses command line options.
- llvm::opt::InputArgList parse(llvm::ArrayRef<const char *> Args);
+ COFFOptTable();
+};
- // Concatenate LINK environment varirable and given arguments and parse them.
+class ArgParser {
+public:
+ // Concatenate LINK environment variable and given arguments and parse them.
llvm::opt::InputArgList parseLINK(std::vector<const char *> Args);
// Tokenizes a given string and then parses as command line options.
llvm::opt::InputArgList parse(StringRef S) { return parse(tokenize(S)); }
private:
+ // Parses command line options.
+ llvm::opt::InputArgList parse(llvm::ArrayRef<const char *> Args);
+
std::vector<const char *> tokenize(StringRef S);
- std::vector<const char *> replaceResponseFiles(std::vector<const char *>);
+ COFFOptTable Table;
};
class LinkerDriver {
public:
- LinkerDriver() { coff::Symtab = &Symtab; }
void link(llvm::ArrayRef<const char *> Args);
// Used by the resolver to parse .drectve section contents.
@@ -70,10 +74,9 @@ public:
void enqueueArchiveMember(const Archive::Child &C, StringRef SymName,
StringRef ParentName);
-private:
- ArgParser Parser;
- SymbolTable Symtab;
+ MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> MB);
+private:
std::unique_ptr<llvm::TarWriter> Tar; // for /linkrepro
// Opens a file. Path has to be resolved already.
@@ -93,7 +96,7 @@ private:
std::set<std::string> VisitedFiles;
std::set<std::string> VisitedLibs;
- SymbolBody *addUndefined(StringRef Sym);
+ Symbol *addUndefined(StringRef Sym);
StringRef mangle(StringRef Sym);
// Windows specific -- "main" is not the only main function in Windows.
@@ -108,12 +111,11 @@ private:
void invokeMSVC(llvm::opt::InputArgList &Args);
- MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> MB);
- void addBuffer(std::unique_ptr<MemoryBuffer> MB);
+ void addBuffer(std::unique_ptr<MemoryBuffer> MB, bool WholeArchive);
void addArchiveBuffer(MemoryBufferRef MBRef, StringRef SymName,
StringRef ParentName);
- void enqueuePath(StringRef Path);
+ void enqueuePath(StringRef Path, bool WholeArchive);
void enqueueTask(std::function<void()> Task);
bool run();
@@ -145,6 +147,7 @@ void parseSubsystem(StringRef Arg, WindowsSubsystem *Sys, uint32_t *Major,
void parseAlternateName(StringRef);
void parseMerge(StringRef);
void parseSection(StringRef);
+void parseAligncomm(StringRef);
// Parses a string in the form of "EMBED[,=<integer>]|NO".
void parseManifest(StringRef Arg);
@@ -167,10 +170,8 @@ void assignExportOrdinals();
// incompatible objects.
void checkFailIfMismatch(StringRef Arg);
-// Convert Windows resource files (.res files) to a .obj file
-// using cvtres.exe.
-std::unique_ptr<MemoryBuffer>
-convertResToCOFF(const std::vector<MemoryBufferRef> &MBs);
+// Convert Windows resource files (.res files) to a .obj file.
+MemoryBufferRef convertResToCOFF(ArrayRef<MemoryBufferRef> MBs);
void runMSVCLinker(std::string Rsp, ArrayRef<StringRef> Objects);