Skip to content

release/23.x: [Clang][Interpreter] Don't pass -fPIC on MSVC (#210507) - #210642

Merged
dyung merged 1 commit into
llvm:release/23.xfrom
llvmbot:issue210507
Jul 22, 2026
Merged

release/23.x: [Clang][Interpreter] Don't pass -fPIC on MSVC (#210507)#210642
dyung merged 1 commit into
llvm:release/23.xfrom
llvmbot:issue210507

Conversation

@llvmbot

@llvmbot llvmbot commented Jul 20, 2026

Copy link
Copy Markdown
Member

Backport 617e4f5

Requested by: @dyung

@llvmbot

llvmbot commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@vgvassilev What do you think about merging this PR to the release branch?

@llvmbot
llvmbot requested a review from vgvassilev July 20, 2026 04:22
@llvmorg-github-actions llvmorg-github-actions Bot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 20, 2026
@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-clang

Author: llvmbot

Changes

Backport 617e4f5

Requested by: @dyung


Full diff: https://github.com/llvm/llvm-project/pull/210642.diff

1 Files Affected:

  • (modified) clang/lib/Interpreter/Interpreter.cpp (+8-2)
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 933a68b50db41..0536fdcd548a2 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -53,6 +53,7 @@
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TargetParser/Host.h"
+#include "llvm/TargetParser/Triple.h"
 #include "llvm/Transforms/Utils/Cloning.h" // for CloneModule
 
 #define DEBUG_TYPE "clang-repl"
@@ -228,8 +229,13 @@ IncrementalCompilerBuilder::create(std::string TT,
   // host symbol may be out of range when the JIT memory is mapped more than
   // 2GB away (as on FreeBSD), breaking tests such as
   // Interpreter/simple-exception.cpp. Insert before user arguments so it can
-  // still be overridden.
-  ClangArgv.insert(ClangArgv.begin() + 1, "-fPIC");
+  // still be overridden. On Windows (excluding Cygwin/MinGW) an explicit
+  // -fPIC is an unsupported driver option that would drop non-x86_64 targets
+  // to PIC level 0; PIC is already the forced default there where relevant,
+  // so don't inject it.
+  llvm::Triple TargetTriple(TT);
+  if (!TargetTriple.isOSWindows() || TargetTriple.isOSCygMing())
+    ClangArgv.insert(ClangArgv.begin() + 1, "-fPIC");
 
   // Prepending -c to force the driver to do something if no action was
   // specified. By prepending we allow users to override the default

@dyung

dyung commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This is needed to fix a test failure in the Windows-11-arm build which blocks it from completing successfully.

@dyung dyung moved this from Needs Triage to Needs Review in LLVM Release Status Jul 20, 2026
@vgvassilev

Copy link
Copy Markdown
Contributor

Looks like a pre merge check is failing.

1 similar comment
@vgvassilev

Copy link
Copy Markdown
Contributor

Looks like a pre merge check is failing.

@dyung

dyung commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Looks like a pre merge check is failing.

The pre-merge check looks more like an infrastructure failure to me, but I've asked @tstellar to take a look since he had previously fixed this test.

On the release branch, I've just been committing fixes even with that failure, but still need a review!

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, if the premerge checks fail due to infra.

@github-project-automation github-project-automation Bot moved this from Needs Review to Needs Merge in LLVM Release Status Jul 21, 2026
@dyung
dyung merged commit a36edf6 into llvm:release/23.x Jul 22, 2026
2 of 3 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Merge to Done in LLVM Release Status Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

Development

Successfully merging this pull request may close these issues.

4 participants