Skip to content

Commit 75ae4c6

Browse files
vitalybukagithub-actions[bot]
authored andcommitted
Automerge: [NFC][CFI] Avoid clang error in CFI tests (#135981)
In these tests we test correct linking flags set, and it's confusing that command fails because of other missing required flags. Clang diagnostics opportunistically proceed after error report on required flags, but there is no guaranty that processing of tested flags are the same in supported and erroneous flag sets.
2 parents 97114b2 + 726a5c2 commit 75ae4c6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

clang/test/Driver/sanitizer-ld.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,8 @@
840840
// CHECK-CFI-PREREQ-LINUX: '-fsanitize=cfi' only allowed with '-fvisibility='
841841

842842
// CFI by itself does not link runtime libraries.
843-
// RUN: not %clang -fsanitize=cfi \
843+
// RUN: %clang -fsanitize=cfi \
844+
// RUN: -flto -fvisibility=hidden \
844845
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld -rtlib=platform \
845846
// RUN: -resource-dir=%S/Inputs/resource_dir \
846847
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -849,7 +850,8 @@
849850
// CHECK-CFI-LINUX: "{{.*}}ld{{(.exe)?}}"
850851

851852
// CFI with diagnostics links the UBSan runtime.
852-
// RUN: not %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
853+
// RUN: %clang -fsanitize=cfi -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
854+
// RUN: -flto -fvisibility=hidden \
853855
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
854856
// RUN: -resource-dir=%S/Inputs/resource_dir \
855857
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -859,7 +861,8 @@
859861
// CHECK-CFI-DIAG-LINUX: "--whole-archive" "{{[^"]*}}libclang_rt.ubsan_standalone.a" "--no-whole-archive"
860862

861863
// Cross-DSO CFI links the CFI runtime.
862-
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
864+
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
865+
// RUN: -flto -fvisibility=hidden \
863866
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
864867
// RUN: -resource-dir=%S/Inputs/resource_dir \
865868
// RUN: --sysroot=%S/Inputs/basic_linux_tree \
@@ -870,7 +873,8 @@
870873
// CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
871874

872875
// Cross-DSO CFI with diagnostics links just the CFI runtime.
873-
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
876+
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
877+
// RUN: -flto -fvisibility=hidden \
874878
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
875879
// RUN: --target=x86_64-unknown-linux -fuse-ld=ld \
876880
// RUN: -resource-dir=%S/Inputs/resource_dir \
@@ -882,7 +886,8 @@
882886
// CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
883887

884888
// Cross-DSO CFI on Android does not link runtime libraries.
885-
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
889+
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
890+
// RUN: -flto -fvisibility=hidden \
886891
// RUN: --target=aarch64-linux-android -fuse-ld=ld \
887892
// RUN: -resource-dir=%S/Inputs/resource_dir \
888893
// RUN: --sysroot=%S/Inputs/basic_android_tree \
@@ -891,7 +896,8 @@
891896
// CHECK-CFI-CROSS-DSO-ANDROID: "{{.*}}ld{{(.exe)?}}"
892897

893898
// Cross-DSO CFI with diagnostics on Android links just the UBSAN runtime.
894-
// RUN: not %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
899+
// RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso \
900+
// RUN: -flto -fvisibility=hidden \
895901
// RUN: -fno-sanitize-trap=cfi -fsanitize-recover=cfi \
896902
// RUN: --target=aarch64-linux-android -fuse-ld=ld \
897903
// RUN: -resource-dir=%S/Inputs/resource_dir \

0 commit comments

Comments
 (0)