| ... | ... | @@ -35,7 +35,6 @@ |
| 35 | 35 | #include <llvm/IR/PassManager.h> |
| 36 | 36 | #include <llvm/IR/Verifier.h> |
| 37 | 37 | #include <llvm/InitializePasses.h> |
| 38 | | #include <llvm/MC/SubtargetFeature.h> |
| 39 | 38 | #include <llvm/MC/TargetRegistry.h> |
| 40 | 39 | #include <llvm/Passes/OptimizationLevel.h> |
| 41 | 40 | #include <llvm/Passes/PassBuilder.h> |
| ... | ... | @@ -47,10 +46,8 @@ |
| 47 | 46 | #include <llvm/Object/COFFModuleDefinition.h> |
| 48 | 47 | #include <llvm/PassRegistry.h> |
| 49 | 48 | #include <llvm/Support/CommandLine.h> |
| 50 | | #include <llvm/Support/Host.h> |
| 51 | 49 | #include <llvm/Support/FileSystem.h> |
| 52 | 50 | #include <llvm/Support/Process.h> |
| 53 | | #include <llvm/Support/TargetParser.h> |
| 54 | 51 | #include <llvm/Support/TimeProfiler.h> |
| 55 | 52 | #include <llvm/Support/Timer.h> |
| 56 | 53 | #include <llvm/Support/raw_ostream.h> |
| ... | ... | @@ -58,7 +55,6 @@ |
| 58 | 55 | #include <llvm/Target/CodeGenCWrappers.h> |
| 59 | 56 | #include <llvm/Transforms/IPO.h> |
| 60 | 57 | #include <llvm/Transforms/IPO/AlwaysInliner.h> |
| 61 | | #include <llvm/Transforms/IPO/PassManagerBuilder.h> |
| 62 | 58 | #include <llvm/Transforms/Instrumentation/ThreadSanitizer.h> |
| 63 | 59 | #include <llvm/Transforms/Scalar.h> |
| 64 | 60 | #include <llvm/Transforms/Utils.h> |
| ... | ... | @@ -1103,6 +1099,24 @@ bool ZigLLVMWriteArchive(const char *archive_name, const char **file_names, size |
| 1103 | 1099 | return false; |
| 1104 | 1100 | } |
| 1105 | 1101 | |
| 1102 | // The header file in LLD 16 exposed these functions. As of 17 they are only |
| 1103 | // exposed via a macro ("LLD_HAS_DRIVER") which I have copied and pasted the |
| 1104 | // body of here so that you don't have to wonder what it is doing. |
| 1105 | namespace lld { |
| 1106 | namespace coff { |
| 1107 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, |
| 1108 | llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); |
| 1109 | } |
| 1110 | namespace elf { |
| 1111 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, |
| 1112 | llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); |
| 1113 | } |
| 1114 | namespace wasm { |
| 1115 | bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS, |
| 1116 | llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput); |
| 1117 | } |
| 1118 | } |
| 1119 | |
| 1106 | 1120 | bool ZigLLDLinkCOFF(int argc, const char **argv, bool can_exit_early, bool disable_output) { |
| 1107 | 1121 | std::vector<const char *> args(argv, argv + argc); |
| 1108 | 1122 | return lld::coff::link(args, llvm::outs(), llvm::errs(), can_exit_early, disable_output); |
| ... | ... | @@ -1249,6 +1263,7 @@ static_assert((Triple::OSType)ZigLLVM_MacOSX == Triple::MacOSX, ""); |
| 1249 | 1263 | static_assert((Triple::OSType)ZigLLVM_NetBSD == Triple::NetBSD, ""); |
| 1250 | 1264 | static_assert((Triple::OSType)ZigLLVM_OpenBSD == Triple::OpenBSD, ""); |
| 1251 | 1265 | static_assert((Triple::OSType)ZigLLVM_Solaris == Triple::Solaris, ""); |
| 1266 | static_assert((Triple::OSType)ZigLLVM_UEFI == Triple::UEFI, ""); |
| 1252 | 1267 | static_assert((Triple::OSType)ZigLLVM_Win32 == Triple::Win32, ""); |
| 1253 | 1268 | static_assert((Triple::OSType)ZigLLVM_ZOS == Triple::ZOS, ""); |
| 1254 | 1269 | static_assert((Triple::OSType)ZigLLVM_Haiku == Triple::Haiku, ""); |
| ... | ... | @@ -1270,6 +1285,8 @@ static_assert((Triple::OSType)ZigLLVM_HermitCore == Triple::HermitCore, ""); |
| 1270 | 1285 | static_assert((Triple::OSType)ZigLLVM_Hurd == Triple::Hurd, ""); |
| 1271 | 1286 | static_assert((Triple::OSType)ZigLLVM_WASI == Triple::WASI, ""); |
| 1272 | 1287 | static_assert((Triple::OSType)ZigLLVM_Emscripten == Triple::Emscripten, ""); |
| 1288 | static_assert((Triple::OSType)ZigLLVM_ShaderModel == Triple::ShaderModel, ""); |
| 1289 | static_assert((Triple::OSType)ZigLLVM_LiteOS == Triple::LiteOS, ""); |
| 1273 | 1290 | static_assert((Triple::OSType)ZigLLVM_LastOSType == Triple::LastOSType, ""); |
| 1274 | 1291 | |
| 1275 | 1292 | static_assert((Triple::EnvironmentType)ZigLLVM_UnknownEnvironment == Triple::UnknownEnvironment, ""); |
| ... | ... | @@ -1297,6 +1314,22 @@ static_assert((Triple::EnvironmentType)ZigLLVM_Cygnus == Triple::Cygnus, ""); |
| 1297 | 1314 | static_assert((Triple::EnvironmentType)ZigLLVM_CoreCLR == Triple::CoreCLR, ""); |
| 1298 | 1315 | static_assert((Triple::EnvironmentType)ZigLLVM_Simulator == Triple::Simulator, ""); |
| 1299 | 1316 | static_assert((Triple::EnvironmentType)ZigLLVM_MacABI == Triple::MacABI, ""); |
| 1317 | static_assert((Triple::EnvironmentType)ZigLLVM_Pixel == Triple::Pixel, ""); |
| 1318 | static_assert((Triple::EnvironmentType)ZigLLVM_Vertex == Triple::Vertex, ""); |
| 1319 | static_assert((Triple::EnvironmentType)ZigLLVM_Geometry == Triple::Geometry, ""); |
| 1320 | static_assert((Triple::EnvironmentType)ZigLLVM_Hull == Triple::Hull, ""); |
| 1321 | static_assert((Triple::EnvironmentType)ZigLLVM_Domain == Triple::Domain, ""); |
| 1322 | static_assert((Triple::EnvironmentType)ZigLLVM_Compute == Triple::Compute, ""); |
| 1323 | static_assert((Triple::EnvironmentType)ZigLLVM_Library == Triple::Library, ""); |
| 1324 | static_assert((Triple::EnvironmentType)ZigLLVM_RayGeneration == Triple::RayGeneration, ""); |
| 1325 | static_assert((Triple::EnvironmentType)ZigLLVM_Intersection == Triple::Intersection, ""); |
| 1326 | static_assert((Triple::EnvironmentType)ZigLLVM_AnyHit == Triple::AnyHit, ""); |
| 1327 | static_assert((Triple::EnvironmentType)ZigLLVM_ClosestHit == Triple::ClosestHit, ""); |
| 1328 | static_assert((Triple::EnvironmentType)ZigLLVM_Miss == Triple::Miss, ""); |
| 1329 | static_assert((Triple::EnvironmentType)ZigLLVM_Callable == Triple::Callable, ""); |
| 1330 | static_assert((Triple::EnvironmentType)ZigLLVM_Mesh == Triple::Mesh, ""); |
| 1331 | static_assert((Triple::EnvironmentType)ZigLLVM_Amplification == Triple::Amplification, ""); |
| 1332 | static_assert((Triple::EnvironmentType)ZigLLVM_OpenHOS == Triple::OpenHOS, ""); |
| 1300 | 1333 | static_assert((Triple::EnvironmentType)ZigLLVM_LastEnvironmentType == Triple::LastEnvironmentType, ""); |
| 1301 | 1334 | |
| 1302 | 1335 | static_assert((Triple::ObjectFormatType)ZigLLVM_UnknownObjectFormat == Triple::UnknownObjectFormat, ""); |
| ... | ... | @@ -1334,8 +1367,8 @@ static_assert((CallingConv::ID)ZigLLVM_Intel_OCL_BI == llvm::CallingConv::Intel_ |
| 1334 | 1367 | static_assert((CallingConv::ID)ZigLLVM_X86_64_SysV == llvm::CallingConv::X86_64_SysV, ""); |
| 1335 | 1368 | static_assert((CallingConv::ID)ZigLLVM_Win64 == llvm::CallingConv::Win64, ""); |
| 1336 | 1369 | static_assert((CallingConv::ID)ZigLLVM_X86_VectorCall == llvm::CallingConv::X86_VectorCall, ""); |
| 1337 | | static_assert((CallingConv::ID)ZigLLVM_HHVM == llvm::CallingConv::HHVM, ""); |
| 1338 | | static_assert((CallingConv::ID)ZigLLVM_HHVM_C == llvm::CallingConv::HHVM_C, ""); |
| 1370 | static_assert((CallingConv::ID)ZigLLVM_DUMMY_HHVM == llvm::CallingConv::DUMMY_HHVM, ""); |
| 1371 | static_assert((CallingConv::ID)ZigLLVM_DUMMY_HHVM_C == llvm::CallingConv::DUMMY_HHVM_C, ""); |
| 1339 | 1372 | static_assert((CallingConv::ID)ZigLLVM_X86_INTR == llvm::CallingConv::X86_INTR, ""); |
| 1340 | 1373 | static_assert((CallingConv::ID)ZigLLVM_AVR_INTR == llvm::CallingConv::AVR_INTR, ""); |
| 1341 | 1374 | static_assert((CallingConv::ID)ZigLLVM_AVR_SIGNAL == llvm::CallingConv::AVR_SIGNAL, ""); |