2020-04-03 02:54:05 +08:00
|
|
|
//===- Driver.h -------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_MACHO_DRIVER_H
|
|
|
|
#define LLD_MACHO_DRIVER_H
|
|
|
|
|
|
|
|
#include "lld/Common/LLVM.h"
|
2020-11-19 01:31:47 +08:00
|
|
|
#include "llvm/ADT/Optional.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
2020-04-03 02:54:05 +08:00
|
|
|
#include "llvm/Option/OptTable.h"
|
2020-11-19 01:31:47 +08:00
|
|
|
#include "llvm/Support/MemoryBuffer.h"
|
2020-04-03 02:54:05 +08:00
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace macho {
|
|
|
|
|
2020-11-19 01:31:47 +08:00
|
|
|
class DylibFile;
|
2020-12-03 07:59:00 +08:00
|
|
|
class InputFile;
|
2020-11-19 01:31:47 +08:00
|
|
|
|
2020-04-03 02:54:05 +08:00
|
|
|
class MachOOptTable : public llvm::opt::OptTable {
|
|
|
|
public:
|
|
|
|
MachOOptTable();
|
|
|
|
llvm::opt::InputArgList parse(ArrayRef<const char *> argv);
|
2020-06-16 03:36:32 +08:00
|
|
|
void printHelp(const char *argv0, bool showHidden) const;
|
2020-04-03 02:54:05 +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, _12) OPT_##ID,
|
|
|
|
#include "Options.inc"
|
|
|
|
#undef OPTION
|
|
|
|
};
|
|
|
|
|
2020-12-04 05:40:04 +08:00
|
|
|
void parseLCLinkerOption(InputFile*, unsigned argc, StringRef data);
|
|
|
|
|
2020-11-29 11:38:27 +08:00
|
|
|
std::string createResponseFile(const llvm::opt::InputArgList &args);
|
|
|
|
|
2020-11-19 01:31:47 +08:00
|
|
|
// Check for both libfoo.dylib and libfoo.tbd (in that order).
|
|
|
|
llvm::Optional<std::string> resolveDylibPath(llvm::StringRef path);
|
|
|
|
|
2020-12-10 14:29:28 +08:00
|
|
|
llvm::Optional<DylibFile *> loadDylib(llvm::MemoryBufferRef mbref,
|
2021-02-23 02:03:02 +08:00
|
|
|
DylibFile *umbrella = nullptr,
|
|
|
|
bool isBundleLoader = false);
|
2020-11-19 01:31:47 +08:00
|
|
|
|
2021-02-04 02:31:42 +08:00
|
|
|
llvm::Optional<InputFile *> loadArchiveMember(MemoryBufferRef, uint32_t modTime,
|
|
|
|
StringRef archiveName,
|
|
|
|
bool objCOnly);
|
|
|
|
|
2020-12-02 06:45:11 +08:00
|
|
|
uint32_t getModTime(llvm::StringRef path);
|
|
|
|
|
2020-12-03 07:57:30 +08:00
|
|
|
void printArchiveMemberLoad(StringRef reason, const InputFile *);
|
2020-12-03 07:59:00 +08:00
|
|
|
|
2020-04-03 02:54:05 +08:00
|
|
|
} // namespace macho
|
|
|
|
} // namespace lld
|
|
|
|
|
|
|
|
#endif
|