Skip to content

Commit 24171f4

Browse files
authored
[NFC][CFI] Add test to check for '-flto' and '-fvisibility=' flags (#135892)
1 parent 7f4422d commit 24171f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang/test/Driver/sanitizer-ld.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,16 @@
829829

830830
// CHECK-NSAN-UBSAN: "--whole-archive" "{{[^"]*}}libclang_rt.nsan.a" "--no-whole-archive"
831831

832+
// CFI requirements.
833+
// RUN: not %clang -fsanitize=cfi \
834+
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
835+
// RUN: -resource-dir=%S/Inputs/resource_dir \
836+
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
837+
// RUN: -### %s 2>&1 \
838+
// RUN: | %{filecheck} --check-prefix=CHECK-CFI-PREREQ-LINUX
839+
// CHECK-CFI-PREREQ-LINUX: '-fsanitize=cfi' only allowed with '-flto'
840+
// CHECK-CFI-PREREQ-LINUX: '-fsanitize=cfi' only allowed with '-fvisibility='
841+
832842
// CFI by itself does not link runtime libraries.
833843
// RUN: not %clang -fsanitize=cfi \
834844
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \

0 commit comments

Comments
 (0)