[clang] [clang][driver] Use platform specific calls to get the executable absolute path (PR #68091)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 13:01:43 PDT 2023


mstorsjo wrote:

> > I haven't checked closely
> 
> Hi Martin, please check the #66704 bug report, the current behaviour is plainly wrong,

I would kind of agree with that in general - resolving this to the actual clang binary would indeed seem like the right thing to do. But it makes me wonder if someone actually is relying on the current behaviour, or is this a case that hasn't been encountered before (symlinks primarily being used within the same bin directory)?

> clang does not pick the correct libraries and silently uses the system libraries, which leads to very subtle and hard to debug errors if the new version is several versions apart from the system.

Well whatever the consequences are of using a different install dir is kinda of irrelevant here IMO; there should be a well defined logic for how that's calculated (and I agree that it ideally should be based on the actual executable), and based on that, each target toolchain has various fallbacks for finding the headers to use if it's not colocated with the compiler.


https://github.com/llvm/llvm-project/pull/68091


More information about the cfe-commits mailing list