================
@@ -1286,6 +1299,16 @@ Compilation *Driver::BuildCompilation(ArrayRef<const 
char *> ArgList) {
           appendOneArg(Args, Opt, nullptr);
         }
     }
+
+    // The config file may have changed the architecture so apply it.
+    if (HasConfigFile && Args.hasArg(options::OPT__SLASH_arm64EC)) {
+      llvm::Triple T(TargetTriple);
+      if (T.getArch() != llvm::Triple::aarch64 ||
+          T.getSubArch() != llvm::Triple::AArch64SubArch_arm64ec) {
+        T.setArch(llvm::Triple::aarch64, llvm::Triple::AArch64SubArch_arm64ec);
+        TargetTriple = T.str();
----------------
Bo98 wrote:

There's two triple systems in the driver: `TargetTriple` and the triple fed to 
`ToolChain` (computed by `computeTargetTriple`). The former is feeds into the 
latter but is otherwise separate.

`-m32` and `-m64` is already handled in `computeTargetTriple` and so never 
affect `TargetTriple`. The code here was to keep the existing behaviour of 
`/arm64EC` affecting `TargetTriple`.

To be honest: I have no idea why there is two triples. It would be simpler if 
`TargetTriple` became `DefaultTriple` (and remains immutable), 
`Driver.getTargetTriple()` was removed and we just moved all this to 
`computeTargetTriple` but I was hesitant to change something I don't understand 
the history of.

https://github.com/llvm/llvm-project/pull/111397
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to