| 1 |
// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fpic -fsemantic-interposition -c -### 2>&1 | FileCheck %s |
| 2 |
// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIC -fsemantic-interposition -c -### 2>&1 | FileCheck %s |
| 3 |
// CHECK: "-fsemantic-interposition" |
| 4 |
|
| 5 |
/// No-op for -fno-pic/-fpie. |
| 6 |
// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fsemantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NOOP %s |
| 7 |
// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIE -fsemantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NOOP %s |
| 8 |
// NOOP-NOT: "-fsemantic-interposition" |
| 9 |
// NOOP-NOT: "-fno-semantic-interposition" |
| 10 |
|
| 11 |
/// If -fno-semantic-interposition is specified and the target supports local |
| 12 |
/// aliases, neither CC1 option is set. |
| 13 |
// RUN: %clang --sysroot=%S/Inputs --target=aarch64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s |
| 14 |
// RUN: %clang --sysroot=%S/Inputs --target=riscv32 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s |
| 15 |
// RUN: %clang --sysroot=%S/Inputs --target=riscv64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s |
| 16 |
// RUN: %clang --sysroot=%S/Inputs --target=i386 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s |
| 17 |
// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s |
| 18 |
// NO-NOT: "-fsemantic-interposition" |
| 19 |
// NO-NOT: "-fhalf-no-semantic-interposition" |
| 20 |
|
| 21 |
/// If neither -fsemantic-interposition or -fno-semantic-interposition is specified, |
| 22 |
/// or -fno-semantic-interposition is specified but the target does not support |
| 23 |
/// local aliases, use the traditional half-baked behavor: interprocedural |
| 24 |
/// optimizations are allowed but local aliases are not used. If references are |
| 25 |
/// not optimized out, semantic interposition at runtime is possible. |
| 26 |
// RUN: %clang --sysroot=%S/Inputs --target=ppc64le %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=HALF %s |
| 27 |
|
| 28 |
// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIC -c -### 2>&1 | FileCheck --check-prefix=HALF %s |
| 29 |
// |
| 30 |
// HALF: "-fhalf-no-semantic-interposition" |