From d74e6f5278e67f42e9a020f81c9eb0272f624618 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 08:06:09 +0000 Subject: feat(driver)!: select LLVM IR output with -S Save native executables by default and LLVM IR with -S, using source-adjacent .out and .ll names. Keep -r independent of output selection and update the manuals and three-platform nightly smoke checks. BREAKING CHANGE: plain compilation and -o now save native executables. Use -S to save textual LLVM IR. Co-Authored-By: Claude Fable 5.1 --- tools/driver/NativeCompiler.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tools/driver/NativeCompiler.cc') diff --git a/tools/driver/NativeCompiler.cc b/tools/driver/NativeCompiler.cc index f2ea3dc..8d798d7 100644 --- a/tools/driver/NativeCompiler.cc +++ b/tools/driver/NativeCompiler.cc @@ -60,7 +60,7 @@ class DriverDiagnostics : public clang::DiagnosticConsumer { } // namespace -bool compileNative(const cps::CodeGen &CG, llvm::StringRef OutputPath) { +bool compileNative(const cps::CodeGen &CG, llvm::StringRef OutputPath, const char *Argv0) { TemporaryDirectory Runtime; if (auto EC = llvm::sys::fs::createUniqueDirectory("cpsc-native", Runtime.Path)) return fail("cannot create native compilation directory: " + EC.message()); @@ -157,10 +157,12 @@ bool compileNative(const cps::CodeGen &CG, llvm::StringRef OutputPath) { DriverDiagnostics Printer; clang::DiagnosticsEngine Diagnostics(new clang::DiagnosticIDs, Options, &Printer, false); clang::driver::Driver Driver("cpsc", Triple.str(), Diagnostics); - // The standard linker flavor constructs a job without checking for an - // installed linker. Its platform arguments are passed to embedded LLD. + // Clang validates the linker executable even for an unlaunched job. Use + // cpsc's own path; only the job's arguments are passed to embedded LLD. std::vector Args = {"cpsc", "--driver-mode=g++", "-nostdlib", "-nostdlib++", - "-fuse-ld=ld", "-o", std::string(StagedPath), std::string(ObjectPath)}; + "-fuse-ld=lld", "-o", std::string(StagedPath), std::string(ObjectPath)}; + Args.push_back("--ld-path=" + llvm::sys::fs::getMainExecutable( + Argv0, reinterpret_cast(&compileNative))); for (const auto &Arg : *Metadata.getArray("arguments")) { Args.push_back("-Xlinker"); Args.push_back(relocate(*Arg.getAsString())); -- cgit v1.3.1-4-g156e