1ece8a530Spatrick //===- lld/Common/Driver.h - Linker Driver Emulator -----------------------===// 2ece8a530Spatrick // 3ece8a530Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4ece8a530Spatrick // See https://llvm.org/LICENSE.txt for license information. 5ece8a530Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6ece8a530Spatrick // 7ece8a530Spatrick //===----------------------------------------------------------------------===// 8ece8a530Spatrick 9ece8a530Spatrick #ifndef LLD_COMMON_DRIVER_H 10ece8a530Spatrick #define LLD_COMMON_DRIVER_H 11ece8a530Spatrick 12ece8a530Spatrick #include "llvm/ADT/ArrayRef.h" 13ece8a530Spatrick #include "llvm/Support/raw_ostream.h" 14ece8a530Spatrick 15ece8a530Spatrick namespace lld { 161cf9926bSpatrick struct SafeReturn { 171cf9926bSpatrick int ret; 181cf9926bSpatrick bool canRunAgain; 191cf9926bSpatrick }; 201cf9926bSpatrick 211cf9926bSpatrick // Generic entry point when using LLD as a library, safe for re-entry, supports 221cf9926bSpatrick // crash recovery. Returns a general completion code and a boolean telling 231cf9926bSpatrick // whether it can be called again. In some cases, a crash could corrupt memory 241cf9926bSpatrick // and re-entry would not be possible anymore. Use exitLld() in that case to 251cf9926bSpatrick // properly exit your application and avoid intermittent crashes on exit caused 261cf9926bSpatrick // by cleanup. 271cf9926bSpatrick SafeReturn safeLldMain(int argc, const char **argv, llvm::raw_ostream &stdoutOS, 281cf9926bSpatrick llvm::raw_ostream &stderrOS); 291cf9926bSpatrick 30ece8a530Spatrick namespace coff { 31*dfe94b16Srobert bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, 32*dfe94b16Srobert llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); 33ece8a530Spatrick } 34ece8a530Spatrick 35ece8a530Spatrick namespace mingw { 36*dfe94b16Srobert bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, 37*dfe94b16Srobert llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); 38ece8a530Spatrick } 39ece8a530Spatrick 40ece8a530Spatrick namespace elf { 41*dfe94b16Srobert bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, 42*dfe94b16Srobert llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); 43ece8a530Spatrick } 44ece8a530Spatrick 45bb684c34Spatrick namespace macho { 46*dfe94b16Srobert bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, 47*dfe94b16Srobert llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); 48bb684c34Spatrick } 49bb684c34Spatrick 50ece8a530Spatrick namespace wasm { 51*dfe94b16Srobert bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, 52*dfe94b16Srobert llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); 53ece8a530Spatrick } 54*dfe94b16Srobert } // namespace lld 55ece8a530Spatrick 56ece8a530Spatrick #endif 57