https://github.com/eugenis created https://github.com/llvm/llvm-project/pull/98194
This helps compatibility with gcc, which has (static|shared)-libasan, but not *-libsan. Clang currently has -shared-libasan -shared-libsan -static-libsan This change improves consistency by adding -static-libasan >From 6bfe2a1ac87e2ff9e354341e4f58b22148dca1bc Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov <euge...@google.com> Date: Tue, 9 Jul 2024 10:23:52 -0700 Subject: [PATCH] Add -static-libasan alias for -static-libsan. This helps compatibility with gcc, which has (static|shared)-libasan, but not *-libsan. Clang currently has -shared-libasan -shared-libsan -static-libsan This change improves consistency by adding -static-libasan --- clang/include/clang/Driver/Options.td | 1 + clang/test/Driver/sanitizer-ld.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index be7c3b60c20f1..93292a35841c4 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1618,6 +1618,7 @@ def shared_libsan : Flag<["-"], "shared-libsan">, def static_libsan : Flag<["-"], "static-libsan">, HelpText<"Statically link the sanitizer runtime (Not supported for ASan, TSan or UBSan on darwin)">; def : Flag<["-"], "shared-libasan">, Alias<shared_libsan>; +def : Flag<["-"], "static-libasan">, Alias<static_libsan>; def fasm : Flag<["-"], "fasm">, Group<f_Group>; defm assume_unique_vtables : BoolFOption<"assume-unique-vtables", diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c index 93702f456229f..e215c034070e0 100644 --- a/clang/test/Driver/sanitizer-ld.c +++ b/clang/test/Driver/sanitizer-ld.c @@ -196,6 +196,13 @@ // RUN: -static-libsan \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s // +// RUN: %clang -### %s 2>&1 \ +// RUN: --target=arm-linux-androideabi -fuse-ld=ld -fsanitize=address \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: -static-libasan \ +// RUN: | FileCheck --check-prefix=CHECK-ASAN-ANDROID-STATICLIBASAN %s +// // CHECK-ASAN-ANDROID-STATICLIBASAN: "{{(.*[^.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}" // CHECK-ASAN-ANDROID-STATICLIBASAN: libclang_rt.asan.a" // CHECK-ASAN-ANDROID-STATICLIBASAN-NOT: "-lpthread" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits