https://github.com/MaxEW707 created https://github.com/llvm/llvm-project/pull/107509
Similar reasoning as this PR: https://github.com/llvm/llvm-project/pull/107177 `-fms-volatile` should be set by default for x86 targets as long as the triple is `*-windows-msvc`. The driver mode shouldn't dictate the triple when targeting msvc compatibility. >From 967a6b841993f756ae4230a92aa8db2d71d20d24 Mon Sep 17 00:00:00 2001 From: MaxEW707 <max.enrico.wink...@gmail.com> Date: Wed, 4 Sep 2024 23:37:45 -0700 Subject: [PATCH] Ensure `ms-volatile` is set for x86 for `*-windows-msvc` triple on non cl driver modes --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/test/Driver/clang_f_opts.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index df86941950e46e..93f9e2af2e0df4 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -6003,7 +6003,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } if (Args.hasFlag(options::OPT_fms_volatile, options::OPT_fno_ms_volatile, - Triple.isX86() && D.IsCLMode())) + Triple.isX86() && IsWindowsMSVC)) CmdArgs.push_back("-fms-volatile"); // Non-PIC code defaults to -fdirect-access-external-data while PIC code diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index d69cd199ac61d7..5047c28e30d667 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -621,6 +621,10 @@ // RUN: %clang -### --target=aarch64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s // RUN: %clang -### --target=aarch64-windows-msvc -fms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s // RUN: %clang -### --target=aarch64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s +// RUN: %clang -### --target=x86_64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s +// RUN: %clang -### --target=x86_64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s +// RUN: %clang -### --target=i686-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s +// RUN: %clang -### --target=i686-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s // CHECK-MS-VOLATILE: -fms-volatile // CHECK-NO-MS-VOLATILE-NOT: -fms-volatile _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits