| 1 |
// UNSUPPORTED: system-windows |
| 2 |
|
| 3 |
// RUN: touch %t.o |
| 4 |
|
| 5 |
// Test HIP runtime lib args specified by --rocm-path. |
| 6 |
// RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ |
| 7 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \ |
| 8 |
// RUN: | FileCheck -check-prefixes=ROCM-PATH %s |
| 9 |
|
| 10 |
// Test HIP runtime lib args specified by environment variable ROCM_PATH. |
| 11 |
// RUN: env ROCM_PATH=%S/Inputs/rocm %clang -### --hip-link \ |
| 12 |
// RUN: --target=x86_64-linux-gnu %t.o 2>&1 \ |
| 13 |
// RUN: | FileCheck -check-prefixes=ROCM-PATH %s |
| 14 |
|
| 15 |
// RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ |
| 16 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o --offload-add-rpath 2>&1 \ |
| 17 |
// RUN: | FileCheck -check-prefixes=ROCM-RPATH %s |
| 18 |
|
| 19 |
// RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ |
| 20 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o -frtlib-add-rpath 2>&1 \ |
| 21 |
// RUN: | FileCheck -check-prefixes=ROCM-RPATH %s |
| 22 |
|
| 23 |
// Test that a canonical HIP runtime path is passed to the -rpath flag |
| 24 |
// RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ |
| 25 |
// RUN: --rocm-path=%S/Inputs/rocm/./bin/../include/../ %t.o -frtlib-add-rpath 2>&1 \ |
| 26 |
// RUN: | FileCheck -check-prefixes=ROCM-RPATH-CANONICAL %s |
| 27 |
|
| 28 |
// Test detecting latest /opt/rocm-{release} directory. |
| 29 |
// RUN: rm -rf %t && mkdir -p %t/opt |
| 30 |
// RUN: cp -r %S/Inputs/rocm %t/opt/rocm-3.9.0-1234 |
| 31 |
// RUN: cp -r %S/Inputs/rocm %t/opt/rocm-3.10.0 |
| 32 |
// RUN: %clang -### --hip-link --target=x86_64-linux-gnu \ |
| 33 |
// RUN: --sysroot=%t %t.o 2>&1 \ |
| 34 |
// RUN: | FileCheck -check-prefixes=ROCM-REL %s |
| 35 |
|
| 36 |
// Test HIP runtime lib is not linked without --hip-link. |
| 37 |
// RUN: %clang -### --target=x86_64-linux-gnu \ |
| 38 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \ |
| 39 |
// RUN: | FileCheck -check-prefixes=NOHIPRT %s |
| 40 |
|
| 41 |
// Test HIP runtime lib is not linked with -nostdlib. |
| 42 |
// RUN: %clang -### --hip-link -nostdlib --target=x86_64-linux-gnu \ |
| 43 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \ |
| 44 |
// RUN: | FileCheck -check-prefixes=NOHIPRT %s |
| 45 |
|
| 46 |
// Test HIP runtime lib is not linked with -no-hip-rt. |
| 47 |
// RUN: %clang -### --hip-link -no-hip-rt --target=x86_64-linux-gnu \ |
| 48 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \ |
| 49 |
// RUN: | FileCheck -check-prefixes=NOHIPRT %s |
| 50 |
|
| 51 |
// Test HIP runtime lib is not linked with -r. |
| 52 |
// RUN: %clang -### --hip-link -r --target=x86_64-linux-gnu \ |
| 53 |
// RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \ |
| 54 |
// RUN: | FileCheck -check-prefixes=NOHIPRT %s |
| 55 |
|
| 56 |
// Test HIP runtime lib is linked without hip-link if there is HIP input file. |
| 57 |
// RUN: %clang -### --target=x86_64-linux-gnu -nogpuinc -nogpulib \ |
| 58 |
// RUN: --rocm-path=%S/Inputs/rocm %s 2>&1 \ |
| 59 |
// RUN: | FileCheck -check-prefixes=ROCM-PATH %s |
| 60 |
|
| 61 |
// ROCM-PATH: "-L[[HIPRT:.*/Inputs/rocm/lib]]" "-lamdhip64" |
| 62 |
// ROCM-RPATH: "-L[[HIPRT:.*/Inputs/rocm/lib]]" "-rpath" "[[HIPRT]]" "-lamdhip64" |
| 63 |
// ROCM-RPATH-CANONICAL: "-rpath" "{{.*/rocm/lib}}" "-lamdhip64" |
| 64 |
// ROCM-REL: "-L[[HIPRT:.*/opt/rocm-3.10.0/lib]]" "-lamdhip64" |
| 65 |
// NOHIPRT-NOT: "-L{{.*/Inputs/rocm/lib}}" |
| 66 |
// NOHIPRT-NOT: "-rpath" "{{.*/Inputs/rocm/lib}}" |
| 67 |
// NOHIPRT-NOT: "-lamdhip64" |