// AMDGPU-specific defaults for PIC.
if (Triple.getArch() == llvm::Triple::amdgcn)
@@ -45,7 +71,7 @@ diff -Naupr
llvm-5.0.1.src/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp llvm
// The last argument relating to either PIC or PIE wins, and no
// other argument is used. If the last argument is any flavor of the
-@@ -955,17 +955,17 @@
+@@ -980,17 +980,17 @@ tools::ParsePICArgs(const ToolChain &Too
if (O.matches(options::OPT_fPIC) || O.matches(options::OPT_fpic) ||
O.matches(options::OPT_fPIE) || O.matches(options::OPT_fpie)) {
PIE = O.matches(options::OPT_fPIE) || O.matches(options::OPT_fpie);
@@ -66,7 +92,7 @@ diff -Naupr
llvm-5.0.1.src/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp llvm
ToolChain.getDriver().Diag(diag::warn_drv_ps4_force_pic)
<< LastPICArg->getSpelling();
}
-@@ -977,7 +977,7 @@
+@@ -1002,7 +1002,7 @@ tools::ParsePICArgs(const ToolChain &Too
// Introduce a Darwin and PS4-specific hack. If the default is PIC, but
the
// PIC level would've been set to level 1, force it back to level 2 PIC
// instead.
@@ -75,7 +101,7 @@ diff -Naupr
llvm-5.0.1.src/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp llvm
IsPICLevelTwo |= ToolChain.isPICDefault();
// This kernel flags are a trump-card: they will disable PIC/PIE
-@@ -985,7 +985,7 @@
+@@ -1010,7 +1010,7 @@ tools::ParsePICArgs(const ToolChain &Too
if (KernelOrKext &&
((!EffectiveTriple.isiOS() || EffectiveTriple.isOSVersionLT(6)) &&
!EffectiveTriple.isWatchOS()))
@@ -84,7 +110,7 @@ diff -Naupr
llvm-5.0.1.src/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp llvm
if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) {
// This is a very special mode. It trumps the other modes, almost no one
-@@ -999,9 +999,9 @@
+@@ -1024,9 +1024,9 @@ tools::ParsePICArgs(const ToolChain &Too
// Only a forced PIC mode can cause the actual compile to have PIC
defines
// etc., no flags are sufficient. This behavior was selected to closely
// match that of llvm-gcc and Apple GCC before that.
@@ -96,7 +122,16 @@ diff -Naupr
llvm-5.0.1.src/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp llvm
}
bool EmbeddedPISupported;
-@@ -1045,7 +1045,7 @@
+@@ -1059,7 +1059,7 @@ tools::ParsePICArgs(const ToolChain &Too
+ }
+
+ // ROPI and RWPI are not compatible with PIC or PIE.
+- if ((ROPI || RWPI) && (PIC || PIE))
++ if ((ROPI || RWPI) && (pic || PIE))
+
ToolChain.getDriver().Diag(diag::err_drv_ropi_rwpi_incompatible_with_pic);
+
+ if (Triple.isMIPS()) {
+@@ -1070,7 +1070,7 @@ tools::ParsePICArgs(const ToolChain &Too
// when the -mno-abicalls option is used. In that case we exit
// at next check regardless of PIC being set below.
if (ABIName == "n64")
@@ -105,7 +140,7 @@ diff -Naupr
llvm-5.0.1.src/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp llvm
// When targettng MIPS with -mno-abicalls, it's always static.
if(Args.hasArg(options::OPT_mno_abicalls))
return std::make_tuple(llvm::Reloc::Static, 0U, false);
-@@ -1054,7 +1054,7 @@
+@@ -1079,7 +1079,7 @@ tools::ParsePICArgs(const ToolChain &Too
IsPICLevelTwo = false;
}