1 // REQUIRES: amdgpu-registered-target, default-pie-on-linux
3 // -fPIC and -fPIE only affects host relocation model.
4 // device compilation always uses PIC.
6 // RUN: %clang -### -target x86_64-unknown-linux-gnu \
7 // RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
8 // RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
10 // RUN: %clang -### -target x86_64-unknown-linux-gnu \
11 // RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
12 // RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
14 // RUN: %clang -### -target x86_64-unknown-linux-gnu \
15 // RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
17 // RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIC %s
19 // RUN: %clang -### -target x86_64-unknown-linux-gnu \
20 // RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
22 // RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIC %s
24 // RUN: %clang -### -target x86_64-unknown-linux-gnu \
25 // RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
27 // RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
29 // RUN: %clang -### -target x86_64-unknown-linux-gnu \
30 // RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
32 // RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
34 // DEV-DAG: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-mrelocation-model" "pic" "-pic-level" "[1|2]".* "-mframe-pointer=all"}}
35 // HOST-PIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2"}}
36 // HOST-PIC-NOT: "-pic-is-pie"
37 // HOST-PIE-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"}}
38 // DEV-NOT: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-pic-is-pie"}}