return getArch() == llvm::Triple::x86_64;
}
+bool MSVCToolChain::isPICDefault() const {
+ return getArch() == llvm::Triple::x86_64;
+}
+
+bool MSVCToolChain::isPIEDefault() const {
+ return false;
+}
+
+bool MSVCToolChain::isPICDefaultForced() const {
+ return getArch() == llvm::Triple::x86_64;
+}
+
#ifdef USE_WIN32
static bool readFullStringValue(HKEY hkey, const char *valueName,
std::string &value) {
bool Generic_GCC::isPICDefault() const {
switch (getArch()) {
- default: return false;
+ case llvm::Triple::x86_64:
+ return getTriple().isOSWindows();
case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
return !getTriple().isOSBinFormatMachO() && !getTriple().isMacOSX();
+ default:
+ return false;
}
}
+bool Generic_GCC::isPIEDefault() const { return false; }
+
+bool Generic_GCC::isPICDefaultForced() const {
+ return getArch() == llvm::Triple::x86_64 && getTriple().isOSWindows();
+}
+
bool Generic_GCC::IsIntegratedAssemblerDefault() const {
switch (getTriple().getArch()) {
case llvm::Triple::x86:
bool IsUnwindTablesDefault() const override;
bool isPICDefault() const override;
- bool isPIEDefault() const override { return false; }
- bool isPICDefaultForced() const override { return false; }
+ bool isPIEDefault() const override;
+ bool isPICDefaultForced() const override;
bool IsIntegratedAssemblerDefault() const override;
llvm::opt::DerivedArgList *
TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
bool IsIntegratedAssemblerDefault() const override;
bool IsUnwindTablesDefault() const override;
- bool isPICDefault() const override { return false; }
- bool isPIEDefault() const override { return false; }
- bool isPICDefaultForced() const override { return false; }
+ bool isPICDefault() const override;
+ bool isPIEDefault() const override;
+ bool isPICDefaultForced() const override;
void
AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
// RUN: %clang -c %s -target arm64-linux-android -### 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-PIC1
-
+//
+// On Windows-X64 PIC is enabled by default
+// RUN: %clang -c %s -target x86_64-pc-windows-msvc18.0.0 -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2
+// RUN: %clang -c %s -target x86_64-pc-windows-gnu -### 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-PIC2