From 8915054461031fffadec03ccb109c3cf425a0292 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Sun, 22 Sep 2019 07:18:49 -0400 Subject: [PATCH] stage1: fix lost argv[0] - bug presented on FreeBSD when `/proc` filesystem is not mounted - bogus `cc` was used as exename, causing incorrect executable spawn - llvm::sys::fs::getMainExecutable() has platform-specific code to get exename and fallback is to use param argv0 - linux fallback is rare because `/proc` is usually mounted - *BSD fallback is not rare because `/proc` is often not mounted - macOS doesn't ever fallback: bug cannot present - windows doesn't ever fallback: bug cannot present - other Posix will always present --- src/zig_clang_driver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zig_clang_driver.cpp b/src/zig_clang_driver.cpp index cc97b722d61f..dd9fb042ec21 100644 --- a/src/zig_clang_driver.cpp +++ b/src/zig_clang_driver.cpp @@ -421,7 +421,7 @@ int ZigClang_main(int argc_, const char **argv_) { ApplyQAOverride(argv, OverrideStr, SavedStrings); } - std::string Path = GetExecutablePath(argv[0], CanonicalPrefixes); + std::string Path = GetExecutablePath(argv_[0], CanonicalPrefixes); IntrusiveRefCntPtr DiagOpts = CreateAndPopulateDiagOpts(argv);