lld_runner.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #ifndef CARBON_TOOLCHAIN_DRIVER_LLD_RUNNER_H_
  5. #define CARBON_TOOLCHAIN_DRIVER_LLD_RUNNER_H_
  6. #include "common/ostream.h"
  7. #include "lld/Common/Driver.h"
  8. #include "llvm/ADT/ArrayRef.h"
  9. #include "llvm/ADT/StringRef.h"
  10. #include "toolchain/base/install_paths.h"
  11. #include "toolchain/driver/tool_runner_base.h"
  12. namespace Carbon {
  13. // Runs LLD in a manner similar to invoking it with the provided arguments.
  14. class LldRunner : ToolRunnerBase {
  15. public:
  16. using ToolRunnerBase::ToolRunnerBase;
  17. // Run LLD as a GNU-style linker with the provided arguments.
  18. auto ElfLink(llvm::ArrayRef<llvm::StringRef> args) -> bool;
  19. // Run LLD as a Darwin-style linker with the provided arguments.
  20. auto MachOLink(llvm::ArrayRef<llvm::StringRef> args) -> bool;
  21. private:
  22. auto LinkHelper(llvm::StringLiteral label,
  23. llvm::ArrayRef<llvm::StringRef> args, const std::string& path,
  24. lld::DriverDef driver_def) -> bool;
  25. };
  26. } // namespace Carbon
  27. #endif // CARBON_TOOLCHAIN_DRIVER_LLD_RUNNER_H_