From 9ef7287d42526014abb0cf2aa53ac2c3087198be Mon Sep 17 00:00:00 2001 From: Wael Yehia Date: Wed, 12 Mar 2025 02:50:54 +0000 Subject: [PATCH] [profile] runtime counter relocation needed on all windows targets (#127858) See PR comments for the discussion that led to this commit. --- clang/lib/Driver/ToolChains/Clang.cpp | 3 +-- clang/test/Driver/fprofile-continuous.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 4ebbd241d2f0..a6a96286e985 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -762,8 +762,7 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C, else { CmdArgs.push_back("-fprofile-continuous"); // Platforms that require a bias variable: - if (T.isOSBinFormatELF() || T.isOSAIX() || - T.isKnownWindowsMSVCEnvironment()) { + if (T.isOSBinFormatELF() || T.isOSAIX() || T.isOSWindows()) { CmdArgs.push_back("-mllvm"); CmdArgs.push_back("-runtime-counter-relocation"); } diff --git a/clang/test/Driver/fprofile-continuous.c b/clang/test/Driver/fprofile-continuous.c index cc8e56c8f9fe..b76f2cd2fe3b 100644 --- a/clang/test/Driver/fprofile-continuous.c +++ b/clang/test/Driver/fprofile-continuous.c @@ -7,6 +7,7 @@ // RUN: %clang --target=powerpc64-ibm-aix -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC // RUN: %clang --target=x86_64-unknown-fuchsia -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC // RUN: %clang --target=x86_64-windows-msvc -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC +// RUN: %clang --target=x86_64-windows-gnu -fprofile-generate -fprofile-continuous -### -c %s 2>&1 | FileCheck %s --check-prefix=RELOC // RELOC: "-cc1" {{.*}} "-fprofile-continuous" "-mllvm" "-runtime-counter-relocation" // 2) test -fprofile-continuous with cs-profile-generate and -fprofile-instr-generate