[clang] [profile] runtime counter relocation is needed on windows-msvc targets (PR #127858)

Anh Tuyen Tran via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 19 13:40:27 PST 2025


================
@@ -795,7 +795,8 @@ 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()) {
+      if (T.isOSBinFormatELF() || T.isOSAIX() ||
+          T.isKnownWindowsMSVCEnvironment()) {
----------------
anhtuyenibm wrote:

Thanks, @w2yehia 
Just a quick question, but since **reloc** is applicable with **_WIN32**, do we only need **T.isOSWindows()**, or is **T.isKnownWindowsMSVCEnvironment()** still required?
```
  bool isOSWindows() const {
    return getOS() == Triple::Win32;
  }
```
VS
```
  /// Checks if the environment is MSVC.
  bool isKnownWindowsMSVCEnvironment() const {
    return isOSWindows() && getEnvironment() == Triple::MSVC;
  }

``` 

https://github.com/llvm/llvm-project/blob/5f8b2568219d5e516928aed67f13b59de8ccee17/llvm/include/llvm/TargetParser/Triple.h#L655

https://github.com/llvm/llvm-project/pull/127858


More information about the cfe-commits mailing list