| In simple-chrome, clang is a shell wrapper, it calls clang.elf, which is the |
| real binary, then, clang.elf calls clang.elf itself. It is the last invocation |
| "clang.elf -> clang.elf" that breaks, because direct calls to clang.elf misses |
| all environment setup in clang wrapper. Fix this by calling to clang wrapper |
| instead of clang.elf binary. |
| |
| diff --git a/tools/clang/tools/driver/driver.cpp b/tools/clang/tools/driver/driver.cpp |
| index ea218d5..561f44f 100644 |
| --- a/clang/tools/driver/driver.cpp |
| +++ b/clang/tools/driver/driver.cpp |
| @@ -409,6 +409,9 @@ int main(int argc_, const char **argv_) { |
| } |
| |
| std::string Path = GetExecutablePath(argv[0], CanonicalPrefixes); |
| + size_t PathLen = Path.length(); |
| + if (PathLen > 4 && Path.substr(PathLen - 4) == ".elf") |
| + Path = Path.substr(0, PathLen - 4); |
| |
| IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = |
| CreateAndPopulateDiagOpts(argv); |