[PATCH] D146908: [clang][MinGW] Add asan link flags before other libs and objects

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 04:33:45 PDT 2023


mstorsjo added inline comments.


================
Comment at: clang/test/Driver/mingw-sanitizers.c:1
-// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-I686 %s
-// ASAN-I686: "{{.*}}libclang_rt.asan_dynamic-i386.dll.a"
-// ASAN-I686: "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a"
-// ASAN-I686: "--require-defined" "___asan_seh_interceptor"
-// ASAN-I686: "--whole-archive" "{{.*}}libclang_rt.asan_dynamic_runtime_thunk-i386.a" "--no-whole-archive"
-
-// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-X86_64 %s
-// ASAN-X86_64: "{{.*}}libclang_rt.asan_dynamic-x86_64.dll.a"
+// RUN: echo -n > %t.a
+// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s
----------------
alvinhochun wrote:
> mstorsjo wrote:
> > alvinhochun wrote:
> > > mstorsjo wrote:
> > > > Hm, what does this do - some sort of more portable version of just touching a file to create it?
> > > Yeah that's just creating the file (though it would also overwrite the existing content). I believe lit has `echo` built-in but `touch` may not be available on Windows so this seems like a good idea to me.
> > Ah, I see. FWIW, the lit tests in general do assume a handful of unix utilities - we seem to have unconditional uses of `touch` in various tests. The lit tests check if these tools are available in path, and if they aren't, it tries to locate an installation of Git for Windows (which contains what's needed) and add that to the path internally: https://github.com/llvm/llvm-project/blob/llvmorg-17-init/llvm/utils/lit/lit/llvm/config.py#L29-L35
> I suppose that works. Would you prefer to use touch here too?
I don't have a strong opinion, but with touch I know what is intended, while this stopped my reading, wondering what the flag to `echo` does and if this is meant to have any specific function other than creating the file.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146908/new/

https://reviews.llvm.org/D146908



More information about the cfe-commits mailing list