2015-05-29 03:09:30 +08:00
|
|
|
//===- Driver.h -----------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Linker
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_COFF_DRIVER_H
|
|
|
|
#define LLD_COFF_DRIVER_H
|
|
|
|
|
|
|
|
#include "Memory.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
2015-05-29 04:30:06 +08:00
|
|
|
#include "llvm/Object/COFF.h"
|
|
|
|
#include "llvm/Option/Arg.h"
|
|
|
|
#include "llvm/Option/ArgList.h"
|
2015-05-29 03:09:30 +08:00
|
|
|
#include <memory>
|
|
|
|
#include <system_error>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace coff {
|
|
|
|
|
2015-05-30 00:06:00 +08:00
|
|
|
using llvm::COFF::MachineTypes;
|
2015-05-29 03:09:30 +08:00
|
|
|
class InputFile;
|
|
|
|
|
2015-05-29 04:30:06 +08:00
|
|
|
ErrorOr<std::unique_ptr<llvm::opt::InputArgList>>
|
|
|
|
parseArgs(int Argc, const char *Argv[]);
|
|
|
|
|
2015-05-29 03:09:30 +08:00
|
|
|
std::error_code parseDirectives(StringRef S,
|
|
|
|
std::vector<std::unique_ptr<InputFile>> *Res,
|
|
|
|
StringAllocator *Alloc);
|
|
|
|
|
2015-05-29 04:30:06 +08:00
|
|
|
// Functions below this line are defined in DriverUtils.cpp.
|
|
|
|
|
2015-05-30 00:11:52 +08:00
|
|
|
void printHelp(const char *Argv0);
|
|
|
|
|
2015-05-29 04:30:06 +08:00
|
|
|
// "ENV" environment variable-aware file finders.
|
|
|
|
std::string findLib(StringRef Filename);
|
|
|
|
std::string findFile(StringRef Filename);
|
|
|
|
|
2015-05-30 00:06:00 +08:00
|
|
|
// For /machine option.
|
|
|
|
ErrorOr<MachineTypes> getMachineType(llvm::opt::InputArgList *Args);
|
|
|
|
|
2015-05-30 00:18:15 +08:00
|
|
|
// Parses a string in the form of "<integer>[,<integer>]".
|
|
|
|
std::error_code parseNumbers(StringRef Arg, uint64_t *Addr,
|
|
|
|
uint64_t *Size = nullptr);
|
|
|
|
|
2015-05-29 04:30:06 +08:00
|
|
|
// Create enum with OPT_xxx values for each option in Options.td
|
|
|
|
enum {
|
|
|
|
OPT_INVALID = 0,
|
|
|
|
#define OPTION(_1, _2, ID, _4, _5, _6, _7, _8, _9, _10, _11) OPT_##ID,
|
|
|
|
#include "Options.inc"
|
|
|
|
#undef OPTION
|
|
|
|
};
|
|
|
|
|
2015-05-29 03:09:30 +08:00
|
|
|
} // namespace coff
|
|
|
|
} // namespace lld
|
|
|
|
|
|
|
|
#endif
|