AMDGPU: Enable PIC by default for amdgcn

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

llvm-svn: 325196
This commit is contained in:
Konstantin Zhuravlyov 2018-02-15 01:01:53 +00:00
parent 47c9b5d4d6
commit b4c83a0bff
2 changed files with 11 additions and 0 deletions

View File

@ -864,6 +864,10 @@ tools::ParsePICArgs(const ToolChain &ToolChain, const ArgList &Args) {
} }
} }
// 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 // 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 // other argument is used. If the last argument is any flavor of the
// '-fno-...' arguments, both PIC and PIE are disabled. Any PIE // '-fno-...' arguments, both PIC and PIE are disabled. Any PIE

View File

@ -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"