[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
This revision was automatically updated to reflect the committed changes. Closed by commit rL325196: AMDGPU: Enable PIC by default for amdgcn (authored by kzhuravl, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D43094?vs=133520&id=134342#toc Repository: rL LLVM https://reviews.llvm.org/D43094 Files: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl Index: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp === --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp +++ cfe/trunk/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 Index: cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl === --- cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl +++ cfe/trunk/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: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp === --- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp +++ cfe/trunk/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 Index: cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl === --- cfe/trunk/test/Driver/amdgcn-toolchain-pic.cl +++ cfe/trunk/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" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
t-tye accepted this revision. t-tye added a comment. For now seems reasonable to fix amdgpu as PIC. If/when other clients of amdgpu have tool chains defined then can switch to controling in the toolchain isPICDefault() function. https://reviews.llvm.org/D43094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
kzhuravl added a comment. Ping. https://reviews.llvm.org/D43094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
msearles accepted this revision. msearles added a comment. This revision is now accepted and ready to land. LGTM https://reviews.llvm.org/D43094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
kzhuravl added a comment. I thought we could override `isPICDefault` in AMDGPUToolChain instead of doing what is posted. But AMDGPUToolChain is only created for AMDHSA OS. Do we want to enable PIC by default for all AMDGCNs? Or only for AMDHSA? https://reviews.llvm.org/D43094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43094: AMDGPU: Enable PIC by default for amdgcn
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 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits