Oleg Ranevskyy
2015-May-21 15:55 UTC
[LLVMdev] Driver::GetProgramPath is unable to find programs with file extension in name
Hello, We are having a problem with linker lookup on Windows. When the driver tries to locate a program by its name, e.g. a linker, it scans the paths provided by the toolchain using ScanDirForExecutable and then, if fails, uses llvm::sys::findProgramByName, which on Windows searches the CWD and system path. ScanDirForExecutable disregards file extensions, so search in the toolchain-provided dirs on Windows fails. llvm::sys::findProgramByName is aware of extensions via the "PATHEXT" env variable (it also has ".exe" hardcoded). However, our linker is not in the CWD or system path, thus search fails. ScanDirForExecutable should respect file extenstions like findProgramByName does. One way of doing so is to make the system dependent llvm::sys::path::access function aware of extensions similarly to findProgramByName. Or the whole ScanDirForExecutable can be made system dependent and add an extension on Windows before passing the path to llvm::sys::fs::can_execute. Does such a patch look reasonable? Any opinions / ideas will be much appreciated. Thanks. Kind regards, Oleg
Reid Kleckner
2015-Jun-05 00:44 UTC
[LLVMdev] Driver::GetProgramPath is unable to find programs with file extension in name
Sorry this is ancient, but yeah, this idea makes sense. Feel free to cc me on a patch for it if you're looking into it. On Thu, May 21, 2015 at 8:55 AM, Oleg Ranevskyy <llvm.mail.list at gmail.com> wrote:> Hello, > > We are having a problem with linker lookup on Windows. > > When the driver tries to locate a program by its name, e.g. a linker, it > scans the paths provided by the toolchain using ScanDirForExecutable and > then, if fails, uses llvm::sys::findProgramByName, which on Windows > searches the CWD and system path. ScanDirForExecutable disregards file > extensions, so search in the toolchain-provided dirs on Windows fails. > llvm::sys::findProgramByName is aware of extensions via the "PATHEXT" env > variable (it also has ".exe" hardcoded). However, our linker is not in the > CWD or system path, thus search fails. > > ScanDirForExecutable should respect file extenstions like > findProgramByName does. One way of doing so is to make the system dependent > llvm::sys::path::access function aware of extensions similarly to > findProgramByName. Or the whole ScanDirForExecutable can be made system > dependent and add an extension on Windows before passing the path to > llvm::sys::fs::can_execute. > > Does such a patch look reasonable? Any opinions / ideas will be much > appreciated. > > Thanks. > Kind regards, > Oleg > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150604/a871d7e4/attachment.html>
Oleg Ranevskyy
2015-Jun-08 17:50 UTC
[LLVMdev] Driver::GetProgramPath is unable to find programs with file extension in name
Hi Reid, Thanks for your attention to this! Ok, I will propose a patch and cc you shortly. Kind regards, Oleg On Fri, Jun 5, 2015 at 3:44 AM, Reid Kleckner <rnk at google.com> wrote:> Sorry this is ancient, but yeah, this idea makes sense. Feel free to cc me > on a patch for it if you're looking into it. > > On Thu, May 21, 2015 at 8:55 AM, Oleg Ranevskyy <llvm.mail.list at gmail.com> > wrote: > >> Hello, >> >> We are having a problem with linker lookup on Windows. >> >> When the driver tries to locate a program by its name, e.g. a linker, it >> scans the paths provided by the toolchain using ScanDirForExecutable and >> then, if fails, uses llvm::sys::findProgramByName, which on Windows >> searches the CWD and system path. ScanDirForExecutable disregards file >> extensions, so search in the toolchain-provided dirs on Windows fails. >> llvm::sys::findProgramByName is aware of extensions via the "PATHEXT" env >> variable (it also has ".exe" hardcoded). However, our linker is not in the >> CWD or system path, thus search fails. >> >> ScanDirForExecutable should respect file extenstions like >> findProgramByName does. One way of doing so is to make the system dependent >> llvm::sys::path::access function aware of extensions similarly to >> findProgramByName. Or the whole ScanDirForExecutable can be made system >> dependent and add an extension on Windows before passing the path to >> llvm::sys::fs::can_execute. >> >> Does such a patch look reasonable? Any opinions / ideas will be much >> appreciated. >> >> Thanks. >> Kind regards, >> Oleg >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150608/c5cd510a/attachment.html>
Reasonably Related Threads
- [LLVMdev] [PATCH 1/2] Trailing whitespace.
- [LLVMdev] [PATCH 2/2] Make Program::ExecuteNoWait return a process ID.
- [LLVMdev] LLVM on Cygwin: why tests don't run
- [LLVMdev] LLVM on Cygwin: why tests don't run
- [LLVMdev] [PATCH 2/2] Make Program::ExecuteNoWait return a process ID.