[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
Konstantin Zhuravlyov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 8 15:32:14 PST 2018
kzhuravl created this revision.
kzhuravl added reviewers: nhaehnle, t-tye, timcorringham, tpr, tstellar.
Herald added subscribers: dstuttard, yaxunl, wdng.
https://reviews.llvm.org/D43094
Files:
lib/Driver/ToolChains/CommonArgs.cpp
test/Driver/amdgcn-toolchain-pic.cl
Index: test/Driver/amdgcn-toolchain-pic.cl
===================================================================
--- test/Driver/amdgcn-toolchain-pic.cl
+++ test/Driver/amdgcn-toolchain-pic.cl
@@ -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"
Index: lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -864,6 +864,10 @@
}
}
+ // 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43094.133520.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180208/6f66e0e2/attachment.bin>
More information about the cfe-commits
mailing list