[clang] [Driver] More flexible rules for loading default configs
Change the default config file loading logic to be more flexible and more readable at the same time. The new algorithm focuses on four locations, in order: 1. <triple>-<mode>.cfg using real driver mode 2. <triple>-<mode>.cfg using executable suffix 3. <triple>.cfg + <mode>.cfg using real driver mode 4. <triple>.cfg + <mode>.cfg using executable suffix This is meant to preserve reasonable level of compatibility with the existing use, while introducing more flexibility and making the code simpler. Notably: 1. In this layout, the actual target triple is normally respected, and e.g. in `-m32` build the `x86_64-*` configs will never be used. 2. Both real driver mode (preferable) and executable suffix are supported. This permits correctly handling calls with explicit `--driver-mode=` while at the same time preserving compatibility with the existing code. 3. The first two locations provide users with the ability to override configuration per specific target+mode combinaton, while the next two make it possible to independently specify per-target and per-mode configuration. 4. All config file locations are applicable independently of whether clang is started via a prefixed executable, or bare `clang`. 5. If the target is not explicitly specified and the executable prefix does not name a valid triple, it is used instead of the actual target triple for backwards compatibility. This is particularly meant to address Gentoo's use case for configuration files: to configure the default runtimes (i.e. `-rtlib=`, `-stdlib=`) and `--gcc-install-dir=` for all the relevant drivers, as well as to make it more convenient for users to override `-W` flags to test compatibility with future versions of Clang easier. Differential Revision: https://reviews.llvm.org/D134337
Loading
Please sign in to comment