blob: 2e296a099dea57b250e21455c543037b37c65cf5 [file] [log] [blame]
// REQUIRES: clang-driver, amdgpu-registered-target
// -fPIC and -fPIE only affects host relocation model.
// device compilation always uses PIC.
// RUN: %clang -### -target x86_64-unknown-linux-gnu \
// RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-STATIC %s
// RUN: %clang -### -target x86_64-unknown-linux-gnu \
// RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-STATIC %s
// RUN: %clang -### -target x86_64-unknown-linux-gnu \
// RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
// RUN: -fPIC \
// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIC %s
// RUN: %clang -### -target x86_64-unknown-linux-gnu \
// RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
// RUN: -fPIC \
// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIC %s
// RUN: %clang -### -target x86_64-unknown-linux-gnu \
// RUN: --offload-arch=gfx906 %s -nogpulib -nogpuinc \
// RUN: -fPIE \
// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
// RUN: %clang -### -target x86_64-unknown-linux-gnu \
// RUN: -fgpu-rdc --offload-arch=gfx906 %s -nogpulib -nogpuinc \
// RUN: -fPIE \
// RUN: 2>&1 | FileCheck -check-prefixes=DEV,HOST-PIE %s
// DEV-DAG: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-mrelocation-model" "pic" "-pic-level" "[1|2]".* "-mframe-pointer=all"}}
// HOST-STATIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "static"}}
// HOST-PIC-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2"}}
// HOST-PIC-NOT: "-pic-is-pie"
// HOST-PIE-DAG: {{".*clang.*".* "-triple" "x86_64-unknown-linux-gnu".* "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie"}}
// DEV-NOT: {{".*clang.*".* "-triple" "amdgcn-amd-amdhsa".* "-pic-is-pie"}}