Author: kzhuravl
Date: Wed Feb 14 17:01:53 2018
New Revision: 325196

URL: http://llvm.org/viewvc/llvm-project?rev=325196&view=rev
Log:
AMDGPU: Enable PIC by default for amdgcn

Differential Revision: https://reviews.llvm.org/D43094

Added:
    cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl
Modified:
    cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=325196&r1=325195&r2=325196&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Wed Feb 14 17:01:53 2018
@@ -864,6 +864,10 @@ tools::ParsePICArgs(const ToolChain &Too
     }
   }
 
+  // AMDGPU-specific defaults for PIC.
+  if (Triple.getArch() == llvm::Triple::amdgcn)
+    PIC = true;
+
   // 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
   // '-fno-...' arguments, both PIC and PIE are disabled. Any PIE

Added: cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl?rev=325196&view=auto
==============================================================================
--- cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl (added)
+++ cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl Wed Feb 14 17:01:53 2018
@@ -0,0 +1,7 @@
+// RUN: %clang -### -target amdgcn-- -mcpu=gfx803 %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target amdgcn-amd- -mcpu=gfx803 %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target amdgcn-amd-amdhsa -mcpu=gfx803 %s 2>&1 | FileCheck 
%s
+// RUN: %clang -### -target amdgcn-amd-amdpal -mcpu=gfx803 %s 2>&1 | FileCheck 
%s
+// RUN: %clang -### -target amdgcn-amd-mesa3d -mcpu=gfx803 %s 2>&1 | FileCheck 
%s
+
+// CHECK: clang{{.*}} "-mrelocation-model" "pic" "-pic-level" "1"


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to