llvm-project/clang/test/Driver/hip-fpie-option.hip

39 lines
1.8 KiB
Plaintext

// 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" "-mframe-pointer=all"}}
// 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"}}