[clang] [Clang][Interpreter] Fix pch-pic-mismatch for all platforms (PR #209183)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 13 06:50:43 PDT 2026
https://github.com/aokblast created https://github.com/llvm/llvm-project/pull/209183
Darwin enforce PIC by default and ignores all -fno-pic option. We calls cc1 directly as its PIC level is 0 by default.
>From 2a1d18efcdaeda32b73757271c479fadc6733075 Mon Sep 17 00:00:00 2001
From: ShengYi Hung <aokblast at FreeBSD.org>
Date: Mon, 13 Jul 2026 21:37:48 +0800
Subject: [PATCH] [Clang][Interpreter] Fix pch-pic-mismatch for all platforms
Darwin enforce PIC by default and ignores all -fno-pic option. We
calls cc1 directly as its PIC level is 0 by default.
---
clang/test/Interpreter/pch-pic-mismatch.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/clang/test/Interpreter/pch-pic-mismatch.cpp b/clang/test/Interpreter/pch-pic-mismatch.cpp
index 0a0a79fbee079..1d0cc73e03b66 100644
--- a/clang/test/Interpreter/pch-pic-mismatch.cpp
+++ b/clang/test/Interpreter/pch-pic-mismatch.cpp
@@ -9,8 +9,11 @@
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
-// RUN: %clang -fno-pic -Xclang -fincremental-extensions -target %host-jit-triple \
-// RUN: -Xclang -emit-pch -x c++-header -o %t/include.pch %t/include.hpp
+// Darwin forces PIC (MachO::isPICDefaultForced) and ignores -fno-pic. To support
+// this patch, we call cc1 directly as it defaults to PIC level 0 everywhere.
+//
+// RUN: %clang_cc1 -triple %host-jit-triple -fincremental-extensions \
+// RUN: -emit-pch -x c++-header -o %t/include.pch %t/include.hpp
//
// RUN: cat %t/main.cpp \
// RUN: | not clang-repl -Xcc -include-pch -Xcc %t/include.pch 2>&1 \
More information about the cfe-commits
mailing list