r290672 - Revert "Driver: switch Windows to static RelocModel"
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 28 09:41:37 PST 2016
Author: rnk
Date: Wed Dec 28 11:41:36 2016
New Revision: 290672
URL: http://llvm.org/viewvc/llvm-project?rev=290672&view=rev
Log:
Revert "Driver: switch Windows to static RelocModel"
This reverts commit r290569. It caused unforeseen codegen changes for
switch jump tables described in PR31488.
Modified:
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/pic.c
Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=290672&r1=290671&r2=290672&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Wed Dec 28 11:41:36 2016
@@ -82,6 +82,18 @@ bool MSVCToolChain::IsUnwindTablesDefaul
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) {
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=290672&r1=290671&r2=290672&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Dec 28 11:41:36 2016
@@ -2880,13 +2880,22 @@ bool Generic_GCC::IsUnwindTablesDefault(
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:
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=290672&r1=290671&r2=290672&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Wed Dec 28 11:41:36 2016
@@ -232,8 +232,8 @@ public:
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,
@@ -1136,9 +1136,9 @@ public:
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,
Modified: cfe/trunk/test/Driver/pic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/pic.c?rev=290672&r1=290671&r2=290672&view=diff
==============================================================================
--- cfe/trunk/test/Driver/pic.c (original)
+++ cfe/trunk/test/Driver/pic.c Wed Dec 28 11:41:36 2016
@@ -255,4 +255,9 @@
// 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
More information about the cfe-commits
mailing list