[PATCH] D135284: [Driver] select alternative target containing . in executable name

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 14:11:15 PDT 2022


MaskRay added a comment.

> The gcc compatible driver has support for selecting an alternative target based on the driver's executable name, for instance x86_64-unknown-linux-gnu-clang will set the target to linux on x86_64.

I think the somewhat canonical term is target override (not selecting an alternative target). This changes makes sense and I think it deserves a test in `Driver/target-override.c` (`REQUIRE: shell` is important for `ln -s %clang ...` to work).

The `.exe` change probably needs to be separate and it's unclear it is needed yet.

> Previously, this failed when the target contains a minor version, for example x86_64-unknown-freebsd13.1, so instead of finding the file's stem, use the whole file name, but strip off any '.exe' from the tail.

Mentioning the literal executable name helps readers understand the nature of the change. This change makes `x86_64-pc-freebsd13.1-clang` to be recognized as having a default target triple of `x86_64-pc-freebsd13.1`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135284/new/

https://reviews.llvm.org/D135284



More information about the cfe-commits mailing list