[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 03:39:32 PDT 2023


mstorsjo added a comment.

I tested this, and this does fix the repro from the linked issue.

I wonder if we do want to move all of these before the app itself, or if it's enough to just move the reference to `asan_dynamic-<arch>.dll.a` earlier, and keep the rest as it was? Especially the whole-archive bit ends up linking a bunch of things statically, ordered way before the app itself. On one hand, I wonder if it would have subtle effects that we don't notice until way later, and we should only change as little as we need (moving the import library reference earlier), or if there are other potential benefits to moving the wholearchive-linked bits earlier too? (I'm wondering about things like constructor execution orders and such.)



================
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
----------------
Hm, what does this do - some sort of more portable version of just touching a file to create it?


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